Merge "Added benchmarks for java.lang."
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWT.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWT.gwt.xml
new file mode 100644
index 0000000..117dcb2
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWT.gwt.xml
@@ -0,0 +1,22 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.Octane"/>
+  <entry-point class="com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.DeltaBlueGWTBenchmark.EntryPoint"/>
+  <replace-with class="com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.OrderedCollectionJsImpl">
+    <when-type-is class="com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.AbstractOrderedCollection"/>
+  </replace-with>
+  <source path="client" includes="deltablue/gwt/*.java,deltablue/gwt/helper/*.java"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWTD8.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWTD8.gwt.xml
new file mode 100644
index 0000000..a097f56
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWTD8.gwt.xml
@@ -0,0 +1,18 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.DeltaBlueBenchmarkGWT"/>
+  <inherits name="com.google.gwt.benchmark.d8.D8"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWTD8JavaCollection.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWTD8JavaCollection.gwt.xml
new file mode 100644
index 0000000..84bb92d
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWTD8JavaCollection.gwt.xml
@@ -0,0 +1,18 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.DeltaBlueBenchmarkGWTJavaCollection"/>
+  <inherits name="com.google.gwt.benchmark.d8.D8"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWTJavaCollection.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWTJavaCollection.gwt.xml
new file mode 100644
index 0000000..cbdb9a0
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkGWTJavaCollection.gwt.xml
@@ -0,0 +1,25 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<!-- This version uses GWT's java emulation instead of hand rolled          -->
+<!-- collection classes                                                     -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.Octane"/>
+  <entry-point class="com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.DeltaBlueGWTBenchmark.EntryPoint"/>
+  <replace-with class="com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.OrderedCollectionJavaImpl">
+    <when-type-is class="com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.AbstractOrderedCollection"/>
+  </replace-with>
+  <source path="client" includes="deltablue/gwt/*.java,deltablue/gwt/helper/*.java"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkJS.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkJS.gwt.xml
new file mode 100644
index 0000000..83f945f
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkJS.gwt.xml
@@ -0,0 +1,19 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.Octane"/>
+  <entry-point class="com.google.gwt.benchmark.benchmarks.octane.client.deltablue.js.DeltaBlueJSBenchmark.EntryPoint"/>
+  <source path="client" includes="deltablue/js/*.java,deltablue/js/*.js"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkJSD8.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkJSD8.gwt.xml
new file mode 100644
index 0000000..7c2a077
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/DeltaBlueBenchmarkJSD8.gwt.xml
@@ -0,0 +1,18 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.DeltaBlueBenchmarkJS"/>
+  <inherits name="com.google.gwt.benchmark.d8.D8"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkGWT.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkGWT.gwt.xml
new file mode 100644
index 0000000..ee0c105
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkGWT.gwt.xml
@@ -0,0 +1,19 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.Octane"/>
+  <entry-point class="com.google.gwt.benchmark.benchmarks.octane.client.navierstokes.gwt.NavierStokesBenchmarkGWT.EntryPoint"/>
+  <source path="client" includes="navierstokes/gwt/*.java"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkGWTD8.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkGWTD8.gwt.xml
new file mode 100644
index 0000000..229f7c2
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkGWTD8.gwt.xml
@@ -0,0 +1,18 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.NavierStokesBenchmarkGWT"/>
+  <inherits name="com.google.gwt.benchmark.d8.D8"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkJS.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkJS.gwt.xml
new file mode 100644
index 0000000..677e66c
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkJS.gwt.xml
@@ -0,0 +1,19 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.Octane"/>
+  <entry-point class="com.google.gwt.benchmark.benchmarks.octane.client.navierstokes.js.NavierStokesJsBenchmark.EntryPoint"/>
+  <source path="client" includes="navierstokes/js/*.java,navierstokes/js/*.js"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkJSD8.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkJSD8.gwt.xml
new file mode 100644
index 0000000..a3b2aa9
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/NavierStokesBenchmarkJSD8.gwt.xml
@@ -0,0 +1,18 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.NavierStokesBenchmarkJS"/>
+  <inherits name="com.google.gwt.benchmark.d8.D8"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/Octane.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/Octane.gwt.xml
new file mode 100644
index 0000000..705379e
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/Octane.gwt.xml
@@ -0,0 +1,17 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.framework.BenchmarkFramework"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/README b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/README
new file mode 100644
index 0000000..d804d68
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/README
@@ -0,0 +1,5 @@
+The benchmarks in this package are a java port of some of the v8 octane
+benchmarks [1]. They were ported to follow the original benchmarks as close as
+possible.
+
+[1] https://code.google.com/p/octane-benchmark/
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkGWT.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkGWT.gwt.xml
new file mode 100644
index 0000000..f54c48b
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkGWT.gwt.xml
@@ -0,0 +1,19 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.Octane"/>
+  <entry-point class="com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt.RayTraceBenchmark.EntryPoint"/>
+  <source path="client" includes="raytrace/gwt/*.java"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkGWTD8.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkGWTD8.gwt.xml
new file mode 100644
index 0000000..11549bd
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkGWTD8.gwt.xml
@@ -0,0 +1,18 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.RayTraceBenchmarkGWT"/>
+  <inherits name="com.google.gwt.benchmark.d8.D8"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkJS.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkJS.gwt.xml
new file mode 100644
index 0000000..28f81a4
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkJS.gwt.xml
@@ -0,0 +1,19 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.Octane"/>
+  <entry-point class="com.google.gwt.benchmark.benchmarks.octane.client.raytrace.js.RayTraceJsBenchmark.EntryPoint"/>
+  <source path="client" includes="raytrace/js/*.java,raytrace/js/*.js"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkJSD8.gwt.xml b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkJSD8.gwt.xml
new file mode 100644
index 0000000..d5363d4
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/RayTraceBenchmarkJSD8.gwt.xml
@@ -0,0 +1,18 @@
+<!--                                                                        -->
+<!-- Copyright 2014 Google Inc.                                             -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
+<!-- may not use this file except in compliance with the License. You may   -->
+<!-- may obtain a copy of the License at                                    -->
+<!--                                                                        -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
+<!--                                                                        -->
+<!-- Unless required by applicable law or agreed to in writing, software    -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
+<!-- implied. License for the specific language governing permissions and   -->
+<!-- limitations under the License.                                         -->
+
+<module>
+  <inherits name="com.google.gwt.benchmark.benchmarks.octane.RayTraceBenchmarkJS"/>
+  <inherits name="com.google.gwt.benchmark.d8.D8"/>
+</module>
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/OctaneJS.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/OctaneJS.java
new file mode 100644
index 0000000..f850b09
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/OctaneJS.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client;
+
+/**
+ * Global information for all octane benchmarks.
+ */
+public class OctaneJS {
+  public static final String PREAMBLE =
+      "var Benchmark = function(){};var BenchmarkSuite = Benchmark;";
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/AbstractOrderedCollection.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/AbstractOrderedCollection.java
new file mode 100644
index 0000000..7ab1aa4
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/AbstractOrderedCollection.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+/**
+ * This class only exists to enable us to run on top of a JVM as well.
+ *
+ * <p>There are two concrete subclasses one for execution in JS environment and
+ * one for execution on the JVM
+ */
+public abstract class AbstractOrderedCollection<T> {
+
+  public abstract void add(T o);
+
+  public abstract T at(int index);
+
+  public abstract int size();
+
+  public abstract T removeFirst();
+
+  public void remove(T elm) {
+    // The whole method seems to be incorrect, but it is a line by line port from the octane
+    // benchmark. This is not a simple remove element method.
+    // We should follow up with the V8 team and maybe fix the original benchmark.
+    int index = 0;
+    int skipped = 0;
+    for (int i = 0; i < size(); i++) {
+      T value = this.at(i);
+      if (notEquals(value, elm)) {
+        set(index, value);
+        index++;
+      } else {
+        skipped++;
+      }
+    }
+    for (int i = 0; i < skipped; i++) {
+      removeFirst();
+    }
+  }
+
+  protected abstract void set(int index, T o);
+
+  protected abstract boolean notEquals(T a, T b);
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/BinaryConstraint.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/BinaryConstraint.java
new file mode 100644
index 0000000..6c25498
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/BinaryConstraint.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+/**
+ * Abstract superclass for constraints having two possible output
+ * variables.
+ */
+public abstract class BinaryConstraint extends Constraint {
+
+  protected Variable v1;
+  protected Variable v2;
+  protected int direction;
+
+  public BinaryConstraint(Variable var1, Variable var2, Strength strength) {
+    super(strength);
+    this.v1 = var1;
+    this.v2 = var2;
+    this.direction = Direction.NONE;
+    // for the java version we have to move the call to addConstraint()
+    // to the child classes since we need to call the parent constructor
+    // first and this would cause the benchmark to fail
+    // this.addConstraint();
+  }
+
+  /**
+   * Decides if this constraint can be satisfied and which way it should flow based on the relative
+   * strength of the variables related, and record that decision.
+   */
+  @Override
+  public void chooseMethod(int mark) {
+    if (this.v1.mark == mark) {
+      this.direction = (this.v2.mark != mark
+          && Strength.stronger(this.strength, this.v2.walkStrength)) ? Direction.FORWARD
+          : Direction.NONE;
+    }
+    if (this.v2.mark == mark) {
+      this.direction = (this.v1.mark != mark
+          && Strength.stronger(this.strength, this.v1.walkStrength)) ? Direction.BACKWARD
+          : Direction.NONE;
+    }
+    if (Strength.weaker(this.v1.walkStrength, this.v2.walkStrength)) {
+      this.direction = Strength.stronger(this.strength, this.v1.walkStrength) ? Direction.BACKWARD
+          : Direction.NONE;
+    } else {
+      this.direction = Strength.stronger(this.strength, this.v2.walkStrength) ? Direction.FORWARD
+          : Direction.BACKWARD;
+    }
+  }
+
+  /**
+   * Add this constraint to the constraint graph
+   */
+  @Override
+  public void addToGraph() {
+    this.v1.addConstraint(this);
+    this.v2.addConstraint(this);
+    this.direction = Direction.NONE;
+  }
+
+  /**
+   * Answer true if this constraint is satisfied in the current solution.
+   */
+  @Override
+  public boolean isSatisfied() {
+    return this.direction != Direction.NONE;
+  }
+
+  /**
+   * Mark the input variable with the given mark.
+   */
+  @Override
+  public void markInputs(int mark) {
+    this.input().mark = mark;
+  }
+
+  /**
+   * Returns the current input variable
+   */
+  public Variable input() {
+    return (this.direction == Direction.FORWARD) ? this.v1 : this.v2;
+  }
+
+  /**
+   * Returns the current output variable
+   */
+
+  @Override
+  public Variable output() {
+    return (this.direction == Direction.FORWARD) ? this.v2 : this.v1;
+  }
+
+  /**
+   * Calculate the walkabout strength, the stay flag, and, if it is 'stay', the value for the
+   * current output of this constraint. Assume this constraint is satisfied.
+   */
+  @Override
+  public void recalculate() {
+    Variable ihn = this.input();
+    Variable out = this.output();
+    out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength);
+    out.stay = ihn.stay;
+    if (out.stay)
+      this.execute();
+  }
+
+  /**
+   * Record the fact that this constraint is unsatisfied.
+   */
+  @Override
+  public void markUnsatisfied() {
+    this.direction = Direction.NONE;
+  }
+
+  @Override
+  public boolean inputsKnown(int mark) {
+    Variable i = this.input();
+    return i.mark == mark || i.stay || i.determinedBy == null;
+  }
+
+  @Override
+  public void removeFromGraph() {
+    if (this.v1 != null)
+      this.v1.removeConstraint(this);
+    if (this.v2 != null)
+      this.v2.removeConstraint(this);
+    this.direction = Direction.NONE;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Constraint.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Constraint.java
new file mode 100644
index 0000000..fa8a886
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Constraint.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+/**
+ * An abstract class representing a system-maintainable relationship
+ * (or "constraint") between a set of variables. A constraint supplies
+ * a strength instance variable; concrete subclasses provide a means
+ * of storing the constrained variables and other information required
+ * to represent a constraint.
+ */
+public abstract class Constraint {
+  protected Strength strength;
+
+  public Constraint(Strength strength) {
+    this.strength = strength;
+  }
+
+  /**
+   * Activate this constraint and attempt to satisfy it.
+   */
+  public void addConstraint() {
+    this.addToGraph();
+    DeltaBlueBenchmark.planner.incrementalAdd(this);
+  }
+
+  protected abstract void addToGraph();
+
+  /**
+   * Attempt to find a way to enforce this constraint. If successful,
+   * record the solution, perhaps modifying the current dataflow
+   * graph. Answer the constraint that this constraint overrides, if
+   * there is one, or nil, if there isn't.
+   * Assume: I am not already satisfied.
+   */
+  public Constraint satisfy(int mark) {
+    this.chooseMethod(mark);
+    if (!this.isSatisfied()) {
+      if (this.strength == Strength.REQUIRED) {
+        // removed console and added RuntimeException
+        // Console.log("Could not satisfy a required constraint!");
+        throw new RuntimeException("Could not satisfy a required constraint!");
+      }
+      return null;
+    }
+    this.markInputs(mark);
+    Variable out = this.output();
+    Constraint overridden = out.determinedBy;
+    if (overridden != null) overridden.markUnsatisfied();
+    out.determinedBy = this;
+    if (!DeltaBlueBenchmark.planner.addPropagate(this, mark)) {
+      // removed console and added RuntimeException
+      // Console.log("Cycle encountered");
+      throw new RuntimeException("Cycle encountered");
+    }
+
+    out.mark = mark;
+    return overridden;
+  }
+
+  public void destroyConstraint() {
+    if (this.isSatisfied()) {
+      DeltaBlueBenchmark.planner.incrementalRemove(this);
+    } else {
+      this.removeFromGraph();
+    }
+  }
+
+  /**
+   * Normal constraints are not input constraints.  An input constraint
+   * is one that depends on external state, such as the mouse, the
+   * keybord, a clock, or some arbitraty piece of imperative code.
+   */
+  public boolean isInput() {
+    return false;
+  }
+
+  protected abstract void removeFromGraph();
+
+  protected abstract void markInputs(int mark);
+
+  protected abstract boolean isSatisfied();
+
+  protected  abstract void chooseMethod(int mark);
+
+  public abstract Variable output();
+
+  public abstract void markUnsatisfied();
+
+  public abstract void execute();
+
+  public abstract void recalculate();
+
+  public abstract boolean inputsKnown(int mark);
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/DeltaBlueBenchmark.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/DeltaBlueBenchmark.java
new file mode 100644
index 0000000..8daae92
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/DeltaBlueBenchmark.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.Abstraction;
+
+public class DeltaBlueBenchmark {
+
+  public static Planner planner;
+
+  /**
+   * This is the standard DeltaBlue benchmark. A long chain of equality constraints is constructed
+   * with a stay constraint on one end. An edit constraint is then added to the opposite end and the
+   * time is measured for adding and removing this constraint, and extracting and executing a
+   * constraint satisfaction plan. There are two cases. In case 1, the added constraint is stronger
+   * than the stay constraint and values must propagate down the entire length of the chain. In case
+   * 2, the added constraint is weaker than the stay constraint so it cannot be accomodated. The cost
+   * in this case is, of course, very low. Typical situations lie somewhere between these two
+   * extremes.
+   */
+  public static void chainTest(int n) {
+    planner = new Planner();
+    Variable prev = null;
+    Variable first = null;
+    Variable last = null;
+
+    // Build chain of n equality constraints
+    for (int i = 0; i <= n; i++) {
+      String name = "v" + i;
+      Variable v = new Variable(name);
+      if (prev != null)
+        new EqualityConstraint(prev, v, Strength.REQUIRED);
+      if (i == 0)
+        first = v;
+      if (i == n)
+        last = v;
+      prev = v;
+    }
+
+    new StayConstraint(last, Strength.STRONG_DEFAULT);
+    Constraint edit = new EditConstraint(first, Strength.PREFERRED);
+    AbstractOrderedCollection<Constraint> edits = Abstraction.create();
+    edits.add(edit);
+    Plan plan = planner.extractPlanFromConstraints(edits);
+    for (int i = 0; i < 100; i++) {
+      first.value = i;
+      plan.execute();
+      if (last.value != i) {
+        // removed console
+        // Console.log("Chain test failed.");
+        // added to make GWT Benchmark framework fail
+        throw new RuntimeException("Chain test failed.");
+      }
+
+    }
+  }
+
+  /**
+   * This test constructs a two sets of variables related to each other by a simple linear
+   * transformation (scale and offset). The time is measured to change a variable on either side of
+   * the mapping and to change the scale and offset factors.
+   */
+  public static void projectionTest(int n) {
+    planner = new Planner();
+    Variable scale = new Variable("scale", 10);
+    Variable offset = new Variable("offset", 1000);
+    Variable src = null, dst = null;
+
+    AbstractOrderedCollection<Variable> dests = Abstraction.create();
+    for (int i = 0; i < n; i++) {
+      src = new Variable("src" + i, i);
+      dst = new Variable("dst" + i, i);
+      dests.add(dst);
+      new StayConstraint(src, Strength.NORMAL);
+      new ScaleConstraint(src, scale, offset, dst, Strength.REQUIRED);
+    }
+
+    change(src, 17);
+    if (dst.value != 1170) {
+      // removed console and added runtime exception
+      // Console.log("Projection 1 failed");
+      throw new RuntimeException("Projection 1 failed");
+    }
+    change(dst, 1050);
+    if (src.value != 5) {
+      // removed console and added runtime exception
+      // Console.log("Projection 2 failed");
+      throw new RuntimeException("Projection 2 failed");
+    }
+    change(scale, 5);
+    for (int i = 0; i < n - 1; i++) {
+      if (dests.at(i).value != i * 5 + 1000) {
+        // removed console and added runtime exception
+        // Console.log("Projection 3 failed");
+        throw new RuntimeException("Projection 3 failed");
+      }
+    }
+    change(offset, 2000);
+    for (int i = 0; i < n - 1; i++) {
+      if (dests.at(i).value != i * 5 + 2000){
+        // removed console and added runtime exception
+        // Console.log("Projection 4 failed");
+        throw new RuntimeException("Projection 4 failed");
+      }
+    }
+  }
+
+  public static void change(Variable v, int newValue) {
+    EditConstraint edit = new EditConstraint(v, Strength.PREFERRED);
+    AbstractOrderedCollection<Constraint> edits = Abstraction.create();
+    edits.add(edit);
+    Plan plan = planner.extractPlanFromConstraints(edits);
+    for (int i = 0; i < 10; i++) {
+      v.value = newValue;
+      plan.execute();
+    }
+    edit.destroyConstraint();
+  }
+
+  public static void deltaBlue() {
+    chainTest(100);
+    projectionTest(100);
+  }
+
+  public static void main(String[] args) {
+    long start = System.currentTimeMillis();
+    for(int i = 0; i < 10000; i++) {
+      deltaBlue();
+    }
+    System.out.println("Took: " + (System.currentTimeMillis() - start));
+  }
+
+  private DeltaBlueBenchmark() {
+  }
+
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/DeltaBlueGWTBenchmark.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/DeltaBlueGWTBenchmark.java
new file mode 100644
index 0000000..80b7a4a
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/DeltaBlueGWTBenchmark.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+import com.google.gwt.benchmark.framework.client.AbstractBenchmarkEntryPoint;
+import com.google.gwt.benchmark.framework.shared.AbstractBenchmark;
+
+public class DeltaBlueGWTBenchmark extends AbstractBenchmark {
+
+  /**
+   * EntryPoint or DeltaBlueGWT benchmark.
+   */
+  public static class EntryPoint extends AbstractBenchmarkEntryPoint {
+
+    @Override
+    protected AbstractBenchmark getBenchmark() {
+      return new DeltaBlueGWTBenchmark();
+    }
+  }
+
+  public DeltaBlueGWTBenchmark() {
+    super("Octane_deltablue_gwt");
+  }
+
+  @Override
+  public Object run() {
+    DeltaBlueBenchmark.deltaBlue();
+    return null;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Direction.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Direction.java
new file mode 100644
index 0000000..371362a
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Direction.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+public class Direction {
+
+  public static final int NONE = 0;
+  public static final int FORWARD = 1;
+  public static final int BACKWARD = -1;
+
+  private Direction() {
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/EditConstraint.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/EditConstraint.java
new file mode 100644
index 0000000..330bc5f
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/EditConstraint.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+/**
+ * A unary input constraint used to mark a variable that the client
+ * wishes to change.
+ */
+public class EditConstraint extends UnaryConstraint {
+
+  public EditConstraint(Variable v, Strength str) {
+    super(v, str);
+  }
+
+  /**
+   * Edits indicate that a variable is to be changed by imperative code.
+   */
+  @Override
+  public boolean isInput() {
+    return true;
+  }
+
+  @Override
+  public void execute() {
+    // Edit constraints do nothing
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/EqualityConstraint.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/EqualityConstraint.java
new file mode 100644
index 0000000..ffc0d36
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/EqualityConstraint.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+/**
+ * Constrains two variables to have the same value.
+ */
+public class EqualityConstraint extends BinaryConstraint {
+
+  public EqualityConstraint(Variable var1, Variable var2, Strength strength) {
+    super(var1, var2, strength);
+    // this line needed to be added see comment in BinaryConstraint's constructor
+    this.addConstraint();
+  }
+
+  /**
+   * Enforce this constraint. Assume that it is satisfied.
+   */
+  @Override
+  public void execute() {
+    this.output().value = this.input().value;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Plan.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Plan.java
new file mode 100644
index 0000000..b5383c1
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Plan.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.Abstraction;
+
+/**
+ * A Plan is an ordered list of constraints to be executed in sequence to resatisfy all currently
+ * satisfiable constraints in the face of one or more changing inputs.
+ */
+public class Plan {
+  private AbstractOrderedCollection<Constraint> v = Abstraction.create();
+
+  public void addConstraint(Constraint c) {
+    this.v.add(c);
+  }
+
+  public int size() {
+    return this.v.size();
+  }
+
+  public Constraint constraintAt(int index) {
+    return this.v.at(index);
+  }
+
+  public void execute() {
+    for (int i = 0; i < this.size(); i++) {
+      Constraint c = this.constraintAt(i);
+      c.execute();
+    }
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Planner.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Planner.java
new file mode 100644
index 0000000..ccbafd7
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Planner.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.Abstraction;
+
+/**
+ * The DeltaBlue planner
+ */
+public class Planner {
+
+  private int currentMark = 0;
+
+  /**
+   * Attempt to satisfy the given constraint and, if successful, incrementally update the dataflow
+   * graph. Details: If satifying the constraint is successful, it may override a weaker constraint
+   * on its output. The algorithm attempts to resatisfy that constraint using some other method.
+   * This process is repeated until either a) it reaches a variable that was not previously
+   * determined by any constraint or b) it reaches a constraint that is too weak to be satisfied
+   * using any of its methods. The variables of constraints that have been processed are marked with
+   * a unique mark value so that we know where we've been. This allows the algorithm to avoid
+   * getting into an infinite loop even if the constraint graph has an inadvertent cycle.
+   */
+  public void incrementalAdd(Constraint c) {
+    int mark = this.newMark();
+    Constraint overridden = c.satisfy(mark);
+    while (overridden != null)
+      overridden = overridden.satisfy(mark);
+  }
+
+  /**
+   * Entry point for retracting a constraint. Remove the given constraint and incrementally update
+   * the dataflow graph. Details: Retracting the given constraint may allow some currently
+   * unsatisfiable downstream constraint to be satisfied. We therefore collect a list of unsatisfied
+   * downstream constraints and attempt to satisfy each one in turn. This list is traversed by
+   * constraint strength, strongest first, as a heuristic for avoiding unnecessarily adding and then
+   * overriding weak constraints. Assume: c is satisfied.
+   */
+  public void incrementalRemove(Constraint c) {
+    Variable out = c.output();
+    c.markUnsatisfied();
+    c.removeFromGraph();
+    AbstractOrderedCollection<Constraint> unsatisfied = this.removePropagateFrom(out);
+    Strength strength = Strength.REQUIRED;
+    do {
+      for (int i = 0; i < unsatisfied.size(); i++) {
+        Constraint u = unsatisfied.at(i);
+        if (u.strength.equals(strength))
+          this.incrementalAdd(u);
+      }
+      strength = strength.nextWeaker();
+    } while (strength != Strength.WEAKEST);
+  }
+
+  /**
+   * Select a previously unused mark value.
+   */
+  public int newMark() {
+    return ++this.currentMark;
+  }
+
+  /**
+   * Extract a plan for resatisfaction starting from the given source constraints, usually a set of
+   * input constraints. This method assumes that stay optimization is desired; the plan will contain
+   * only constraints whose output variables are not stay. Constraints that do no computation, such
+   * as stay and edit constraints, are not included in the plan. Details: The outputs of a
+   * constraint are marked when it is added to the plan under construction. A constraint may be
+   * appended to the plan when all its input variables are known. A variable is known if either a)
+   * the variable is marked (indicating that has been computed by a constraint appearing earlier in
+   * the plan), b) the variable is 'stay' (i.e. it is a constant at plan execution time), or c) the
+   * variable is not determined by any constraint. The last provision is for past states of history
+   * variables, which are not stay but which are also not computed by any constraint. Assume:
+   * sources are all satisfied.
+   */
+  public Plan makePlan(AbstractOrderedCollection<Constraint> sources) {
+    int mark = this.newMark();
+    Plan plan = new Plan();
+    AbstractOrderedCollection<Constraint> todo = sources;
+    while (todo.size() > 0) {
+      Constraint c = todo.removeFirst();
+      if (c.output().mark != mark && c.inputsKnown(mark)) {
+        plan.addConstraint(c);
+        c.output().mark = mark;
+        this.addConstraintsConsumingTo(c.output(), todo);
+      }
+    }
+    return plan;
+  }
+
+  /**
+   * Extract a plan for resatisfying starting from the output of the given constraints, usually a
+   * set of input constraints.
+   */
+  public Plan extractPlanFromConstraints(AbstractOrderedCollection<Constraint> constraints) {
+    AbstractOrderedCollection<Constraint> sources = Abstraction.create();
+    for (int i = 0; i < constraints.size(); i++) {
+      Constraint c = constraints.at(i);
+      if (c.isInput() && c.isSatisfied())
+        // not in plan already and eligible for inclusion
+        sources.add(c);
+    }
+    return this.makePlan(sources);
+  }
+
+  /**
+   * Recompute the walkabout strengths and stay flags of all variables downstream of the given
+   * constraint and recompute the actual values of all variables whose stay flag is true. If a cycle
+   * is detected, remove the given constraint and answer false. Otherwise, answer true. Details:
+   * Cycles are detected when a marked variable is encountered downstream of the given constraint.
+   * The sender is assumed to have marked the inputs of the given constraint with the given mark.
+   * Thus, encountering a marked node downstream of the output constraint means that there is a path
+   * from the constraint's output to one of its inputs.
+   */
+  public boolean addPropagate(Constraint c, int mark) {
+    AbstractOrderedCollection<Constraint> todo = Abstraction.create();
+    todo.add(c);
+    while (todo.size() > 0) {
+      Constraint d = todo.removeFirst();
+      if (d.output().mark == mark) {
+        this.incrementalRemove(c);
+        return false;
+      }
+      d.recalculate();
+      this.addConstraintsConsumingTo(d.output(), todo);
+    }
+    return true;
+  }
+
+  /**
+   * Update the walkabout strengths and stay flags of all variables downstream of the given
+   * constraint. Answer a collection of unsatisfied constraints sorted in order of decreasing
+   * strength.
+   */
+  public AbstractOrderedCollection<Constraint> removePropagateFrom(Variable out) {
+    out.determinedBy = null;
+    out.walkStrength = Strength.WEAKEST;
+    out.stay = true;
+    AbstractOrderedCollection<Constraint> unsatisfied = Abstraction.create();
+    AbstractOrderedCollection<Variable> todo = Abstraction.create();
+    todo.add(out);
+    while (todo.size() > 0) {
+      Variable v = todo.removeFirst();
+      for (int i = 0; i < v.constraints.size(); i++) {
+        Constraint c = v.constraints.at(i);
+        if (!c.isSatisfied())
+          unsatisfied.add(c);
+      }
+      Constraint determining = v.determinedBy;
+      for (int i = 0; i < v.constraints.size(); i++) {
+        Constraint next = v.constraints.at(i);
+        if (!next.equals(determining) && next.isSatisfied()) {
+          next.recalculate();
+          todo.add(next.output());
+        }
+      }
+    }
+    return unsatisfied;
+  }
+
+  public void addConstraintsConsumingTo(Variable v, AbstractOrderedCollection<Constraint> coll) {
+    Constraint determining = v.determinedBy;
+    AbstractOrderedCollection<Constraint> cc = v.constraints;
+    for (int i = 0; i < cc.size(); i++) {
+      Constraint c = cc.at(i);
+      if (Abstraction.jsNotEquals(c, determining) && c.isSatisfied())
+        coll.add(c);
+    }
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/ScaleConstraint.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/ScaleConstraint.java
new file mode 100644
index 0000000..dcde7e9
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/ScaleConstraint.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+/**
+ * Relates two variables by the linear scaling relationship: "v2 =
+ * (v1 * scale) + offset". Either v1 or v2 may be changed to maintain
+ * this relationship but the scale factor and offset are considered
+ * read-only.
+ */
+public class ScaleConstraint extends BinaryConstraint {
+
+  private Variable scale;
+  private Variable offset;
+
+  public ScaleConstraint(Variable src, Variable scale, Variable offset, Variable dest, Strength strength) {
+    super(src, dest, strength);
+    this.direction = Direction.NONE;
+    this.scale = scale;
+    this.offset = offset;
+    // this line needed to be added see comment in BinaryConstraint's constructor
+    this.addConstraint();
+  }
+
+  /**
+   * Adds this constraint to the constraint graph.
+   */
+  @Override
+  public void addToGraph() {
+    super.addToGraph();
+    this.scale.addConstraint(this);
+    this.offset.addConstraint(this);
+  }
+
+  @Override
+  public void removeFromGraph() {
+    super.removeFromGraph();
+    if (this.scale != null) this.scale.removeConstraint(this);
+    if (this.offset != null) this.offset.removeConstraint(this);
+  }
+
+  @Override
+  public void markInputs(int mark) {
+    super.markInputs(mark);
+    this.scale.mark = this.offset.mark = mark;
+  }
+
+  /**
+   * Enforce this constraint. Assume that it is satisfied.
+   */
+  @Override
+  public void execute() {
+    if (this.direction == Direction.FORWARD) {
+      this.v2.value = this.v1.value * this.scale.value + this.offset.value;
+    } else {
+      this.v1.value = (this.v2.value - this.offset.value) / this.scale.value;
+    }
+  }
+
+  /**
+   * Calculate the walkabout strength, the stay flag, and, if it is
+   * 'stay', the value for the current output of this constraint. Assume
+   * this constraint is satisfied.
+   */
+  @Override
+  public void recalculate() {
+    Variable ihn = this.input();
+    Variable out = this.output();
+    out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength);
+    out.stay = ihn.stay && this.scale.stay && this.offset.stay;
+    if (out.stay) this.execute();
+  }
+
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/StayConstraint.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/StayConstraint.java
new file mode 100644
index 0000000..9704354
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/StayConstraint.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+/**
+ * Variables that should, with some level of preference, stay the same.
+ * Planners may exploit the fact that instances, if satisfied, will not
+ * change their output during plan execution.  This is called "stay
+ * optimization".
+ */
+public class StayConstraint extends UnaryConstraint {
+
+  public StayConstraint(Variable v, Strength strength) {
+    super(v, strength);
+  }
+
+  @Override
+  public void execute() {
+    // Stay constraints do nothing
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Strength.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Strength.java
new file mode 100644
index 0000000..e53a85c
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Strength.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+/**
+ * Strengths are used to measure the relative importance of constraints.
+ * New strengths may be inserted in the strength hierarchy without
+ * disrupting current constraints.  Strengths cannot be created outside
+ * this class, so pointer comparison can be used for value comparison.
+ */
+public class Strength {
+
+  public static final Strength REQUIRED = new Strength(0, "required");
+  public static final Strength STONG_PREFERRED = new Strength(1, "strongPreferred");
+  public static final Strength PREFERRED = new Strength(2, "preferred");
+  public static final Strength STRONG_DEFAULT = new Strength(3, "strongDefault");
+  public static final Strength NORMAL = new Strength(4, "normal");
+  public static final Strength WEAK_DEFAULT = new Strength(5, "weakDefault");
+  public static final Strength WEAKEST = new Strength(6, "weakest");
+
+  public static boolean stronger(Strength s1, Strength s2) {
+    return s1.strengthValue < s2.strengthValue;
+  }
+
+  public static boolean weaker(Strength s1, Strength s2) {
+    return s1.strengthValue > s2.strengthValue;
+  }
+
+  public static Strength weakestOf(Strength s1, Strength s2) {
+    return weaker(s1, s2) ? s1 : s2;
+  }
+
+  public static Strength strongest(Strength s1, Strength s2) {
+    return stronger(s1, s2) ? s1 : s2;
+  }
+
+  private int strengthValue;
+  private String name;
+
+  private Strength(int strengthValue, String name) {
+    this.strengthValue = strengthValue;
+    this.name = name;
+  }
+
+  public Strength nextWeaker() {
+    switch (this.strengthValue) {
+      case 0:
+        return Strength.WEAKEST;
+      case 1:
+        return Strength.WEAK_DEFAULT;
+      case 2:
+        return Strength.NORMAL;
+      case 3:
+        return Strength.STRONG_DEFAULT;
+      case 4:
+        return Strength.PREFERRED;
+      case 5:
+        return Strength.REQUIRED;
+    }
+    throw new RuntimeException();
+  }
+
+  @Override
+  public int hashCode() {
+    final int prime = 31;
+    int result = 1;
+    result = prime * result + ((name == null) ? 0 : name.hashCode());
+    result = prime * result + strengthValue;
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj)
+      return true;
+    if (obj == null)
+      return false;
+    Strength other = (Strength) obj;
+    if (strengthValue != other.strengthValue)
+      return false;
+    return true;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/UnaryConstraint.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/UnaryConstraint.java
new file mode 100644
index 0000000..b085f32
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/UnaryConstraint.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+/**
+ * Abstract superclass for constraints having a single possible output
+ * variable.
+ */
+public abstract class  UnaryConstraint extends Constraint {
+
+  private Variable myOutput;
+  private boolean satisfied;
+
+  public UnaryConstraint(Variable v, Strength strength) {
+    super(strength);
+    this.myOutput = v;
+    this.satisfied = false;
+    this.addConstraint();
+  }
+
+  /**
+   * Adds this constraint to the constraint graph
+   */
+  @Override
+  public void addToGraph() {
+    this.myOutput.addConstraint(this);
+    this.satisfied = false;
+  }
+
+  /**
+   * Decides if this constraint can be satisfied and records that
+   * decision.
+   */
+  @Override
+  public void chooseMethod(int mark) {
+    this.satisfied = (this.myOutput.mark != mark)
+      && Strength.stronger(this.strength, this.myOutput.walkStrength);
+  }
+
+  /**
+   * Returns true if this constraint is satisfied in the current solution.
+   */
+  @Override
+  public boolean isSatisfied() {
+    return this.satisfied;
+  }
+
+  @Override
+  public void markInputs(int mark) {
+    // has no inputs
+  }
+
+  /**
+   * Returns the current output variable.
+   */
+  @Override
+  public Variable output() {
+    return this.myOutput;
+  }
+
+  /**
+   * Calculate the walkabout strength, the stay flag, and, if it is
+   * 'stay', the value for the current output of this constraint. Assume
+   * this constraint is satisfied.
+   */
+  @Override
+  public void recalculate() {
+    this.myOutput.walkStrength = this.strength;
+    this.myOutput.stay = !this.isInput();
+    if (this.myOutput.stay) this.execute(); // Stay optimization
+  }
+
+  /**
+   * Records that this constraint is unsatisfied
+   */
+  @Override
+  public void markUnsatisfied() {
+    this.satisfied = false;
+  }
+
+  @Override
+  public boolean inputsKnown(int mark) {
+    return true;
+  }
+
+  @Override
+  public void removeFromGraph() {
+    if (this.myOutput != null) this.myOutput.removeConstraint(this);
+    this.satisfied = false;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Variable.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Variable.java
new file mode 100644
index 0000000..6b627e6
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/Variable.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.Abstraction;
+
+/**
+ * A constrained variable. In addition to its value, it maintain the
+ * structure of the constraint graph, the current dataflow graph, and
+ * various parameters of interest to the DeltaBlue incremental
+ * constraint solver.
+ **/
+public class Variable {
+
+  public int mark;
+  public String name;
+  public int value;
+  public AbstractOrderedCollection<Constraint> constraints;
+  public Constraint determinedBy;
+  public Strength walkStrength;
+  public boolean stay;
+
+  public Variable(String name) {
+    this(name, 0);
+  }
+
+  public Variable(String name, int intialValue) {
+    this.value = intialValue;
+    this.constraints = Abstraction.create();
+    this.determinedBy = null;
+    this.walkStrength = Strength.WEAKEST;
+    this.stay = true;
+    this.name = name;
+  }
+
+  /**
+   * Add the given constraint to the set of all constraints that refer this variable.
+   */
+  public void addConstraint(Constraint c) {
+    this.constraints.add(c);
+  }
+
+  /**
+   * Removes all traces of c from this variable.
+   */
+  public void removeConstraint(Constraint c) {
+    this.constraints.remove(c);
+    if (this.determinedBy == null && c == null
+        || (this.determinedBy != null && this.determinedBy.equals(c))) {
+      c = null;
+    }
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/helper/Abstraction.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/helper/Abstraction.java
new file mode 100644
index 0000000..ac2146a
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/helper/Abstraction.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.AbstractOrderedCollection;
+import com.google.gwt.core.client.GWT;
+
+/**
+ * Abstraction allows to construct different objects for JS code and JVM code.
+ */
+public class Abstraction {
+
+ public static <T> AbstractOrderedCollection<T>  create(){
+   if(GWT.isScript()) {
+     // Allow GWT test to select different implementations
+     return GWT.create(AbstractOrderedCollection.class);
+   } else{
+     return new OrderedCollectionJavaImpl<T>();
+   }
+ }
+
+ public static boolean jsNotEquals(Object a, Object b) {
+   if(GWT.isScript()) {
+     return notEquals(a, b);
+   } else {
+     return a != b;
+   }
+ }
+
+ private static native boolean notEquals(Object a, Object b) /*-{
+   return a != b
+ }-*/;
+}
\ No newline at end of file
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/helper/OrderedCollectionJavaImpl.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/helper/OrderedCollectionJavaImpl.java
new file mode 100644
index 0000000..390abb7
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/helper/OrderedCollectionJavaImpl.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.AbstractOrderedCollection;
+
+import java.util.ArrayList;
+
+/**
+ * Java implementation of {@link AbstractOrderedCollection}.
+ *
+ * This enables us to run the benchmark on a JVM
+ */
+public class OrderedCollectionJavaImpl<T> extends AbstractOrderedCollection<T> {
+
+  private ArrayList<T> list = new ArrayList<T>();
+
+  @Override
+  public void add(T o) {
+    list.add(o);
+  }
+
+  @Override
+  public T at(int index) {
+    return list.get(index);
+  }
+
+  @Override
+  public int size() {
+    return list.size();
+  }
+
+  @Override
+  public T removeFirst() {
+    return list.remove(0);
+  }
+
+  @Override
+  protected void set(int index, T o) {
+    list.set(index, o);
+  }
+
+  @Override
+  protected boolean notEquals(T a, T b) {
+    return a != b;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/helper/OrderedCollectionJsImpl.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/helper/OrderedCollectionJsImpl.java
new file mode 100644
index 0000000..1cf0b96
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/gwt/helper/OrderedCollectionJsImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.AbstractOrderedCollection;
+import com.google.gwt.core.client.JavaScriptObject;
+
+/**
+ * JavaScript implementation of {@link AbstractOrderedCollection}.
+ *
+ * This is implemented this way to exactly mimic the benchmark from JavaScript
+ */
+public class OrderedCollectionJsImpl<T> extends AbstractOrderedCollection<T> {
+
+  private JavaScriptObject array = JavaScriptObject.createArray();
+
+  @Override
+  public native void add(T o) /*-{
+    this.@com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.OrderedCollectionJsImpl::array.push(o);
+  }-*/;
+
+  @Override
+  public native T at(int index) /*-{
+    return this.@com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.OrderedCollectionJsImpl::array[index];
+  }-*/;
+
+  @Override
+  public native int size() /*-{
+    return this.@com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.OrderedCollectionJsImpl::array.length;
+  }-*/;
+
+  @Override
+  public native T removeFirst() /*-{
+    return this.@com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.OrderedCollectionJsImpl::array.pop();
+  }-*/;
+
+  @Override
+  public native void set(int index, T o) /*-{
+    this.@com.google.gwt.benchmark.benchmarks.octane.client.deltablue.gwt.helper.OrderedCollectionJsImpl::array[index] = o;
+  }-*/;
+
+  @Override
+  public native boolean notEquals(T a, T b) /*-{
+    return a != b
+  }-*/;
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/js/DeltaBlueJSBenchmark.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/js/DeltaBlueJSBenchmark.java
new file mode 100644
index 0000000..09ae61b
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/js/DeltaBlueJSBenchmark.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.deltablue.js;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.OctaneJS;
+import com.google.gwt.benchmark.framework.client.AbstractBenchmarkEntryPoint;
+import com.google.gwt.benchmark.framework.client.Injector;
+import com.google.gwt.benchmark.framework.client.Injector.GlobalMapping;
+import com.google.gwt.benchmark.framework.shared.AbstractBenchmark;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.TextResource;
+
+public class DeltaBlueJSBenchmark extends AbstractBenchmark {
+  static {
+    Resource r = GWT.create(Resource.class);
+    new Injector().injectJavaScript(OctaneJS.PREAMBLE +  r.deltaBlueJavaScript().getText(),
+        new GlobalMapping("__octane__deltablue_js_run", "deltaBlue"));
+  }
+
+  public static class EntryPoint extends AbstractBenchmarkEntryPoint {
+
+    @Override
+    protected AbstractBenchmark getBenchmark() {
+      return new DeltaBlueJSBenchmark();
+    }
+  }
+
+  interface Resource extends ClientBundle {
+    @Source("deltablue.js")
+    TextResource deltaBlueJavaScript();
+  }
+
+  public DeltaBlueJSBenchmark() {
+    super("Octane_deltablue_js");
+  }
+
+  @Override
+  public native Object run() /*-{
+    return $wnd.__octane__deltablue_js_run();
+  }-*/;
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/js/deltablue.js b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/js/deltablue.js
new file mode 100644
index 0000000..c5699e6
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/deltablue/js/deltablue.js
@@ -0,0 +1,883 @@
+// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 1996 John Maloney and Mario Wolczko.
+
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+// This implementation of the DeltaBlue benchmark is derived
+// from the Smalltalk implementation by John Maloney and Mario
+// Wolczko. Some parts have been translated directly, whereas
+// others have been modified more aggresively to make it feel
+// more like a JavaScript program.
+
+// removed for GWT consumption
+// var DeltaBlue = new BenchmarkSuite('DeltaBlue', [66118], [
+//   new Benchmark('DeltaBlue', true, false, 4400, deltaBlue)
+// ]);
+
+
+/**
+ * A JavaScript implementation of the DeltaBlue constraint-solving
+ * algorithm, as described in:
+ *
+ * "The DeltaBlue Algorithm: An Incremental Constraint Hierarchy Solver"
+ *   Bjorn N. Freeman-Benson and John Maloney
+ *   January 1990 Communications of the ACM,
+ *   also available as University of Washington TR 89-08-06.
+ *
+ * Beware: this benchmark is written in a grotesque style where
+ * the constraint model is built by side-effects from constructors.
+ * I've kept it this way to avoid deviating too much from the original
+ * implementation.
+ */
+
+
+/* --- O b j e c t   M o d e l --- */
+
+Object.defineProperty(Object.prototype, "inheritsFrom", {
+  
+  value: function (shuper) {
+    function Inheriter() { }
+    Inheriter.prototype = shuper.prototype;
+    this.prototype = new Inheriter();
+    this.superConstructor = shuper;
+  }
+});
+
+function OrderedCollection() {
+  this.elms = new Array();
+}
+
+OrderedCollection.prototype.add = function (elm) {
+  this.elms.push(elm);
+}
+
+OrderedCollection.prototype.at = function (index) {
+  return this.elms[index];
+}
+
+OrderedCollection.prototype.size = function () {
+  return this.elms.length;
+}
+
+OrderedCollection.prototype.removeFirst = function () {
+  return this.elms.pop();
+}
+
+OrderedCollection.prototype.remove = function (elm) {
+  var index = 0, skipped = 0;
+  for (var i = 0; i < this.elms.length; i++) {
+    var value = this.elms[i];
+    if (value != elm) {
+      this.elms[index] = value;
+      index++;
+    } else {
+      skipped++;
+    }
+  }
+  for (var i = 0; i < skipped; i++)
+    this.elms.pop();
+}
+
+/* --- *
+ * S t r e n g t h
+ * --- */
+
+/**
+ * Strengths are used to measure the relative importance of constraints.
+ * New strengths may be inserted in the strength hierarchy without
+ * disrupting current constraints.  Strengths cannot be created outside
+ * this class, so pointer comparison can be used for value comparison.
+ */
+function Strength(strengthValue, name) {
+  this.strengthValue = strengthValue;
+  this.name = name;
+}
+
+Strength.stronger = function (s1, s2) {
+  return s1.strengthValue < s2.strengthValue;
+}
+
+Strength.weaker = function (s1, s2) {
+  return s1.strengthValue > s2.strengthValue;
+}
+
+Strength.weakestOf = function (s1, s2) {
+  return this.weaker(s1, s2) ? s1 : s2;
+}
+
+Strength.strongest = function (s1, s2) {
+  return this.stronger(s1, s2) ? s1 : s2;
+}
+
+Strength.prototype.nextWeaker = function () {
+  switch (this.strengthValue) {
+    case 0: return Strength.WEAKEST;
+    case 1: return Strength.WEAK_DEFAULT;
+    case 2: return Strength.NORMAL;
+    case 3: return Strength.STRONG_DEFAULT;
+    case 4: return Strength.PREFERRED;
+    case 5: return Strength.REQUIRED;
+  }
+}
+
+// Strength constants.
+Strength.REQUIRED        = new Strength(0, "required");
+Strength.STONG_PREFERRED = new Strength(1, "strongPreferred");
+Strength.PREFERRED       = new Strength(2, "preferred");
+Strength.STRONG_DEFAULT  = new Strength(3, "strongDefault");
+Strength.NORMAL          = new Strength(4, "normal");
+Strength.WEAK_DEFAULT    = new Strength(5, "weakDefault");
+Strength.WEAKEST         = new Strength(6, "weakest");
+
+/* --- *
+ * C o n s t r a i n t
+ * --- */
+
+/**
+ * An abstract class representing a system-maintainable relationship
+ * (or "constraint") between a set of variables. A constraint supplies
+ * a strength instance variable; concrete subclasses provide a means
+ * of storing the constrained variables and other information required
+ * to represent a constraint.
+ */
+function Constraint(strength) {
+  this.strength = strength;
+}
+
+/**
+ * Activate this constraint and attempt to satisfy it.
+ */
+Constraint.prototype.addConstraint = function () {
+  this.addToGraph();
+  planner.incrementalAdd(this);
+}
+
+/**
+ * Attempt to find a way to enforce this constraint. If successful,
+ * record the solution, perhaps modifying the current dataflow
+ * graph. Answer the constraint that this constraint overrides, if
+ * there is one, or nil, if there isn't.
+ * Assume: I am not already satisfied.
+ */
+Constraint.prototype.satisfy = function (mark) {
+  this.chooseMethod(mark);
+  if (!this.isSatisfied()) {
+    if (this.strength == Strength.REQUIRED)
+      alert("Could not satisfy a required constraint!");
+    return null;
+  }
+  this.markInputs(mark);
+  var out = this.output();
+  var overridden = out.determinedBy;
+  if (overridden != null) overridden.markUnsatisfied();
+  out.determinedBy = this;
+  if (!planner.addPropagate(this, mark))
+    alert("Cycle encountered");
+  out.mark = mark;
+  return overridden;
+}
+
+Constraint.prototype.destroyConstraint = function () {
+  if (this.isSatisfied()) planner.incrementalRemove(this);
+  else this.removeFromGraph();
+}
+
+/**
+ * Normal constraints are not input constraints.  An input constraint
+ * is one that depends on external state, such as the mouse, the
+ * keybord, a clock, or some arbitraty piece of imperative code.
+ */
+Constraint.prototype.isInput = function () {
+  return false;
+}
+
+/* --- *
+ * U n a r y   C o n s t r a i n t
+ * --- */
+
+/**
+ * Abstract superclass for constraints having a single possible output
+ * variable.
+ */
+function UnaryConstraint(v, strength) {
+  UnaryConstraint.superConstructor.call(this, strength);
+  this.myOutput = v;
+  this.satisfied = false;
+  this.addConstraint();
+}
+
+UnaryConstraint.inheritsFrom(Constraint);
+
+/**
+ * Adds this constraint to the constraint graph
+ */
+UnaryConstraint.prototype.addToGraph = function () {
+  this.myOutput.addConstraint(this);
+  this.satisfied = false;
+}
+
+/**
+ * Decides if this constraint can be satisfied and records that
+ * decision.
+ */
+UnaryConstraint.prototype.chooseMethod = function (mark) {
+  this.satisfied = (this.myOutput.mark != mark)
+    && Strength.stronger(this.strength, this.myOutput.walkStrength);
+}
+
+/**
+ * Returns true if this constraint is satisfied in the current solution.
+ */
+UnaryConstraint.prototype.isSatisfied = function () {
+  return this.satisfied;
+}
+
+UnaryConstraint.prototype.markInputs = function (mark) {
+  // has no inputs
+}
+
+/**
+ * Returns the current output variable.
+ */
+UnaryConstraint.prototype.output = function () {
+  return this.myOutput;
+}
+
+/**
+ * Calculate the walkabout strength, the stay flag, and, if it is
+ * 'stay', the value for the current output of this constraint. Assume
+ * this constraint is satisfied.
+ */
+UnaryConstraint.prototype.recalculate = function () {
+  this.myOutput.walkStrength = this.strength;
+  this.myOutput.stay = !this.isInput();
+  if (this.myOutput.stay) this.execute(); // Stay optimization
+}
+
+/**
+ * Records that this constraint is unsatisfied
+ */
+UnaryConstraint.prototype.markUnsatisfied = function () {
+  this.satisfied = false;
+}
+
+UnaryConstraint.prototype.inputsKnown = function () {
+  return true;
+}
+
+UnaryConstraint.prototype.removeFromGraph = function () {
+  if (this.myOutput != null) this.myOutput.removeConstraint(this);
+  this.satisfied = false;
+}
+
+/* --- *
+ * S t a y   C o n s t r a i n t
+ * --- */
+
+/**
+ * Variables that should, with some level of preference, stay the same.
+ * Planners may exploit the fact that instances, if satisfied, will not
+ * change their output during plan execution.  This is called "stay
+ * optimization".
+ */
+function StayConstraint(v, str) {
+  StayConstraint.superConstructor.call(this, v, str);
+}
+
+StayConstraint.inheritsFrom(UnaryConstraint);
+
+StayConstraint.prototype.execute = function () {
+  // Stay constraints do nothing
+}
+
+/* --- *
+ * E d i t   C o n s t r a i n t
+ * --- */
+
+/**
+ * A unary input constraint used to mark a variable that the client
+ * wishes to change.
+ */
+function EditConstraint(v, str) {
+  EditConstraint.superConstructor.call(this, v, str);
+}
+
+EditConstraint.inheritsFrom(UnaryConstraint);
+
+/**
+ * Edits indicate that a variable is to be changed by imperative code.
+ */
+EditConstraint.prototype.isInput = function () {
+  return true;
+}
+
+EditConstraint.prototype.execute = function () {
+  // Edit constraints do nothing
+}
+
+/* --- *
+ * B i n a r y   C o n s t r a i n t
+ * --- */
+
+var Direction = new Object();
+Direction.NONE     = 0;
+Direction.FORWARD  = 1;
+Direction.BACKWARD = -1;
+
+/**
+ * Abstract superclass for constraints having two possible output
+ * variables.
+ */
+function BinaryConstraint(var1, var2, strength) {
+  BinaryConstraint.superConstructor.call(this, strength);
+  this.v1 = var1;
+  this.v2 = var2;
+  this.direction = Direction.NONE;
+  this.addConstraint();
+}
+
+BinaryConstraint.inheritsFrom(Constraint);
+
+/**
+ * Decides if this constraint can be satisfied and which way it
+ * should flow based on the relative strength of the variables related,
+ * and record that decision.
+ */
+BinaryConstraint.prototype.chooseMethod = function (mark) {
+  if (this.v1.mark == mark) {
+    this.direction = (this.v2.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength))
+      ? Direction.FORWARD
+      : Direction.NONE;
+  }
+  if (this.v2.mark == mark) {
+    this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v1.walkStrength))
+      ? Direction.BACKWARD
+      : Direction.NONE;
+  }
+  if (Strength.weaker(this.v1.walkStrength, this.v2.walkStrength)) {
+    this.direction = Strength.stronger(this.strength, this.v1.walkStrength)
+      ? Direction.BACKWARD
+      : Direction.NONE;
+  } else {
+    this.direction = Strength.stronger(this.strength, this.v2.walkStrength)
+      ? Direction.FORWARD
+      : Direction.BACKWARD
+  }
+}
+
+/**
+ * Add this constraint to the constraint graph
+ */
+BinaryConstraint.prototype.addToGraph = function () {
+  this.v1.addConstraint(this);
+  this.v2.addConstraint(this);
+  this.direction = Direction.NONE;
+}
+
+/**
+ * Answer true if this constraint is satisfied in the current solution.
+ */
+BinaryConstraint.prototype.isSatisfied = function () {
+  return this.direction != Direction.NONE;
+}
+
+/**
+ * Mark the input variable with the given mark.
+ */
+BinaryConstraint.prototype.markInputs = function (mark) {
+  this.input().mark = mark;
+}
+
+/**
+ * Returns the current input variable
+ */
+BinaryConstraint.prototype.input = function () {
+  return (this.direction == Direction.FORWARD) ? this.v1 : this.v2;
+}
+
+/**
+ * Returns the current output variable
+ */
+BinaryConstraint.prototype.output = function () {
+  return (this.direction == Direction.FORWARD) ? this.v2 : this.v1;
+}
+
+/**
+ * Calculate the walkabout strength, the stay flag, and, if it is
+ * 'stay', the value for the current output of this
+ * constraint. Assume this constraint is satisfied.
+ */
+BinaryConstraint.prototype.recalculate = function () {
+  var ihn = this.input(), out = this.output();
+  out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength);
+  out.stay = ihn.stay;
+  if (out.stay) this.execute();
+}
+
+/**
+ * Record the fact that this constraint is unsatisfied.
+ */
+BinaryConstraint.prototype.markUnsatisfied = function () {
+  this.direction = Direction.NONE;
+}
+
+BinaryConstraint.prototype.inputsKnown = function (mark) {
+  var i = this.input();
+  return i.mark == mark || i.stay || i.determinedBy == null;
+}
+
+BinaryConstraint.prototype.removeFromGraph = function () {
+  if (this.v1 != null) this.v1.removeConstraint(this);
+  if (this.v2 != null) this.v2.removeConstraint(this);
+  this.direction = Direction.NONE;
+}
+
+/* --- *
+ * S c a l e   C o n s t r a i n t
+ * --- */
+
+/**
+ * Relates two variables by the linear scaling relationship: "v2 =
+ * (v1 * scale) + offset". Either v1 or v2 may be changed to maintain
+ * this relationship but the scale factor and offset are considered
+ * read-only.
+ */
+function ScaleConstraint(src, scale, offset, dest, strength) {
+  this.direction = Direction.NONE;
+  this.scale = scale;
+  this.offset = offset;
+  ScaleConstraint.superConstructor.call(this, src, dest, strength);
+}
+
+ScaleConstraint.inheritsFrom(BinaryConstraint);
+
+/**
+ * Adds this constraint to the constraint graph.
+ */
+ScaleConstraint.prototype.addToGraph = function () {
+  ScaleConstraint.superConstructor.prototype.addToGraph.call(this);
+  this.scale.addConstraint(this);
+  this.offset.addConstraint(this);
+}
+
+ScaleConstraint.prototype.removeFromGraph = function () {
+  ScaleConstraint.superConstructor.prototype.removeFromGraph.call(this);
+  if (this.scale != null) this.scale.removeConstraint(this);
+  if (this.offset != null) this.offset.removeConstraint(this);
+}
+
+ScaleConstraint.prototype.markInputs = function (mark) {
+  ScaleConstraint.superConstructor.prototype.markInputs.call(this, mark);
+  this.scale.mark = this.offset.mark = mark;
+}
+
+/**
+ * Enforce this constraint. Assume that it is satisfied.
+ */
+ScaleConstraint.prototype.execute = function () {
+  if (this.direction == Direction.FORWARD) {
+    this.v2.value = this.v1.value * this.scale.value + this.offset.value;
+  } else {
+    this.v1.value = (this.v2.value - this.offset.value) / this.scale.value;
+  }
+}
+
+/**
+ * Calculate the walkabout strength, the stay flag, and, if it is
+ * 'stay', the value for the current output of this constraint. Assume
+ * this constraint is satisfied.
+ */
+ScaleConstraint.prototype.recalculate = function () {
+  var ihn = this.input(), out = this.output();
+  out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength);
+  out.stay = ihn.stay && this.scale.stay && this.offset.stay;
+  if (out.stay) this.execute();
+}
+
+/* --- *
+ * E q u a l i t  y   C o n s t r a i n t
+ * --- */
+
+/**
+ * Constrains two variables to have the same value.
+ */
+function EqualityConstraint(var1, var2, strength) {
+  EqualityConstraint.superConstructor.call(this, var1, var2, strength);
+}
+
+EqualityConstraint.inheritsFrom(BinaryConstraint);
+
+/**
+ * Enforce this constraint. Assume that it is satisfied.
+ */
+EqualityConstraint.prototype.execute = function () {
+  this.output().value = this.input().value;
+}
+
+/* --- *
+ * V a r i a b l e
+ * --- */
+
+/**
+ * A constrained variable. In addition to its value, it maintain the
+ * structure of the constraint graph, the current dataflow graph, and
+ * various parameters of interest to the DeltaBlue incremental
+ * constraint solver.
+ **/
+function Variable(name, initialValue) {
+  this.value = initialValue || 0;
+  this.constraints = new OrderedCollection();
+  this.determinedBy = null;
+  this.mark = 0;
+  this.walkStrength = Strength.WEAKEST;
+  this.stay = true;
+  this.name = name;
+}
+
+/**
+ * Add the given constraint to the set of all constraints that refer
+ * this variable.
+ */
+Variable.prototype.addConstraint = function (c) {
+  this.constraints.add(c);
+}
+
+/**
+ * Removes all traces of c from this variable.
+ */
+Variable.prototype.removeConstraint = function (c) {
+  this.constraints.remove(c);
+  if (this.determinedBy == c) this.determinedBy = null;
+}
+
+/* --- *
+ * P l a n n e r
+ * --- */
+
+/**
+ * The DeltaBlue planner
+ */
+function Planner() {
+  this.currentMark = 0;
+}
+
+/**
+ * Attempt to satisfy the given constraint and, if successful,
+ * incrementally update the dataflow graph.  Details: If satifying
+ * the constraint is successful, it may override a weaker constraint
+ * on its output. The algorithm attempts to resatisfy that
+ * constraint using some other method. This process is repeated
+ * until either a) it reaches a variable that was not previously
+ * determined by any constraint or b) it reaches a constraint that
+ * is too weak to be satisfied using any of its methods. The
+ * variables of constraints that have been processed are marked with
+ * a unique mark value so that we know where we've been. This allows
+ * the algorithm to avoid getting into an infinite loop even if the
+ * constraint graph has an inadvertent cycle.
+ */
+Planner.prototype.incrementalAdd = function (c) {
+  var mark = this.newMark();
+  var overridden = c.satisfy(mark);
+  while (overridden != null)
+    overridden = overridden.satisfy(mark);
+}
+
+/**
+ * Entry point for retracting a constraint. Remove the given
+ * constraint and incrementally update the dataflow graph.
+ * Details: Retracting the given constraint may allow some currently
+ * unsatisfiable downstream constraint to be satisfied. We therefore collect
+ * a list of unsatisfied downstream constraints and attempt to
+ * satisfy each one in turn. This list is traversed by constraint
+ * strength, strongest first, as a heuristic for avoiding
+ * unnecessarily adding and then overriding weak constraints.
+ * Assume: c is satisfied.
+ */
+Planner.prototype.incrementalRemove = function (c) {
+  var out = c.output();
+  c.markUnsatisfied();
+  c.removeFromGraph();
+  var unsatisfied = this.removePropagateFrom(out);
+  var strength = Strength.REQUIRED;
+  do {
+    for (var i = 0; i < unsatisfied.size(); i++) {
+      var u = unsatisfied.at(i);
+      if (u.strength == strength)
+        this.incrementalAdd(u);
+    }
+    strength = strength.nextWeaker();
+  } while (strength != Strength.WEAKEST);
+}
+
+/**
+ * Select a previously unused mark value.
+ */
+Planner.prototype.newMark = function () {
+  return ++this.currentMark;
+}
+
+/**
+ * Extract a plan for resatisfaction starting from the given source
+ * constraints, usually a set of input constraints. This method
+ * assumes that stay optimization is desired; the plan will contain
+ * only constraints whose output variables are not stay. Constraints
+ * that do no computation, such as stay and edit constraints, are
+ * not included in the plan.
+ * Details: The outputs of a constraint are marked when it is added
+ * to the plan under construction. A constraint may be appended to
+ * the plan when all its input variables are known. A variable is
+ * known if either a) the variable is marked (indicating that has
+ * been computed by a constraint appearing earlier in the plan), b)
+ * the variable is 'stay' (i.e. it is a constant at plan execution
+ * time), or c) the variable is not determined by any
+ * constraint. The last provision is for past states of history
+ * variables, which are not stay but which are also not computed by
+ * any constraint.
+ * Assume: sources are all satisfied.
+ */
+Planner.prototype.makePlan = function (sources) {
+  var mark = this.newMark();
+  var plan = new Plan();
+  var todo = sources;
+  while (todo.size() > 0) {
+    var c = todo.removeFirst();
+    if (c.output().mark != mark && c.inputsKnown(mark)) {
+      plan.addConstraint(c);
+      c.output().mark = mark;
+      this.addConstraintsConsumingTo(c.output(), todo);
+    }
+  }
+  return plan;
+}
+
+/**
+ * Extract a plan for resatisfying starting from the output of the
+ * given constraints, usually a set of input constraints.
+ */
+Planner.prototype.extractPlanFromConstraints = function (constraints) {
+  var sources = new OrderedCollection();
+  for (var i = 0; i < constraints.size(); i++) {
+    var c = constraints.at(i);
+    if (c.isInput() && c.isSatisfied())
+      // not in plan already and eligible for inclusion
+      sources.add(c);
+  }
+  return this.makePlan(sources);
+}
+
+/**
+ * Recompute the walkabout strengths and stay flags of all variables
+ * downstream of the given constraint and recompute the actual
+ * values of all variables whose stay flag is true. If a cycle is
+ * detected, remove the given constraint and answer
+ * false. Otherwise, answer true.
+ * Details: Cycles are detected when a marked variable is
+ * encountered downstream of the given constraint. The sender is
+ * assumed to have marked the inputs of the given constraint with
+ * the given mark. Thus, encountering a marked node downstream of
+ * the output constraint means that there is a path from the
+ * constraint's output to one of its inputs.
+ */
+Planner.prototype.addPropagate = function (c, mark) {
+  var todo = new OrderedCollection();
+  todo.add(c);
+  while (todo.size() > 0) {
+    var d = todo.removeFirst();
+    if (d.output().mark == mark) {
+      this.incrementalRemove(c);
+      return false;
+    }
+    d.recalculate();
+    this.addConstraintsConsumingTo(d.output(), todo);
+  }
+  return true;
+}
+
+
+/**
+ * Update the walkabout strengths and stay flags of all variables
+ * downstream of the given constraint. Answer a collection of
+ * unsatisfied constraints sorted in order of decreasing strength.
+ */
+Planner.prototype.removePropagateFrom = function (out) {
+  out.determinedBy = null;
+  out.walkStrength = Strength.WEAKEST;
+  out.stay = true;
+  var unsatisfied = new OrderedCollection();
+  var todo = new OrderedCollection();
+  todo.add(out);
+  while (todo.size() > 0) {
+    var v = todo.removeFirst();
+    for (var i = 0; i < v.constraints.size(); i++) {
+      var c = v.constraints.at(i);
+      if (!c.isSatisfied())
+        unsatisfied.add(c);
+    }
+    var determining = v.determinedBy;
+    for (var i = 0; i < v.constraints.size(); i++) {
+      var next = v.constraints.at(i);
+      if (next != determining && next.isSatisfied()) {
+        next.recalculate();
+        todo.add(next.output());
+      }
+    }
+  }
+  return unsatisfied;
+}
+
+Planner.prototype.addConstraintsConsumingTo = function (v, coll) {
+  var determining = v.determinedBy;
+  var cc = v.constraints;
+  for (var i = 0; i < cc.size(); i++) {
+    var c = cc.at(i);
+    if (c != determining && c.isSatisfied())
+      coll.add(c);
+  }
+}
+
+/* --- *
+ * P l a n
+ * --- */
+
+/**
+ * A Plan is an ordered list of constraints to be executed in sequence
+ * to resatisfy all currently satisfiable constraints in the face of
+ * one or more changing inputs.
+ */
+function Plan() {
+  this.v = new OrderedCollection();
+}
+
+Plan.prototype.addConstraint = function (c) {
+  this.v.add(c);
+}
+
+Plan.prototype.size = function () {
+  return this.v.size();
+}
+
+Plan.prototype.constraintAt = function (index) {
+  return this.v.at(index);
+}
+
+Plan.prototype.execute = function () {
+  for (var i = 0; i < this.size(); i++) {
+    var c = this.constraintAt(i);
+    c.execute();
+  }
+}
+
+/* --- *
+ * M a i n
+ * --- */
+
+/**
+ * This is the standard DeltaBlue benchmark. A long chain of equality
+ * constraints is constructed with a stay constraint on one end. An
+ * edit constraint is then added to the opposite end and the time is
+ * measured for adding and removing this constraint, and extracting
+ * and executing a constraint satisfaction plan. There are two cases.
+ * In case 1, the added constraint is stronger than the stay
+ * constraint and values must propagate down the entire length of the
+ * chain. In case 2, the added constraint is weaker than the stay
+ * constraint so it cannot be accomodated. The cost in this case is,
+ * of course, very low. Typical situations lie somewhere between these
+ * two extremes.
+ */
+function chainTest(n) {
+  planner = new Planner();
+  var prev = null, first = null, last = null;
+
+  // Build chain of n equality constraints
+  for (var i = 0; i <= n; i++) {
+    var name = "v" + i;
+    var v = new Variable(name);
+    if (prev != null)
+      new EqualityConstraint(prev, v, Strength.REQUIRED);
+    if (i == 0) first = v;
+    if (i == n) last = v;
+    prev = v;
+  }
+
+  new StayConstraint(last, Strength.STRONG_DEFAULT);
+  var edit = new EditConstraint(first, Strength.PREFERRED);
+  var edits = new OrderedCollection();
+  edits.add(edit);
+  var plan = planner.extractPlanFromConstraints(edits);
+  for (var i = 0; i < 100; i++) {
+    first.value = i;
+    plan.execute();
+    if (last.value != i)
+      alert("Chain test failed.");
+  }
+}
+
+/**
+ * This test constructs a two sets of variables related to each
+ * other by a simple linear transformation (scale and offset). The
+ * time is measured to change a variable on either side of the
+ * mapping and to change the scale and offset factors.
+ */
+function projectionTest(n) {
+  planner = new Planner();
+  var scale = new Variable("scale", 10);
+  var offset = new Variable("offset", 1000);
+  var src = null, dst = null;
+
+  var dests = new OrderedCollection();
+  for (var i = 0; i < n; i++) {
+    src = new Variable("src" + i, i);
+    dst = new Variable("dst" + i, i);
+    dests.add(dst);
+    new StayConstraint(src, Strength.NORMAL);
+    new ScaleConstraint(src, scale, offset, dst, Strength.REQUIRED);
+  }
+
+  change(src, 17);
+  if (dst.value != 1170) alert("Projection 1 failed");
+  change(dst, 1050);
+  if (src.value != 5) alert("Projection 2 failed");
+  change(scale, 5);
+  for (var i = 0; i < n - 1; i++) {
+    if (dests.at(i).value != i * 5 + 1000)
+      alert("Projection 3 failed");
+  }
+  change(offset, 2000);
+  for (var i = 0; i < n - 1; i++) {
+    if (dests.at(i).value != i * 5 + 2000)
+      alert("Projection 4 failed");
+  }
+}
+
+function change(v, newValue) {
+  var edit = new EditConstraint(v, Strength.PREFERRED);
+  var edits = new OrderedCollection();
+  edits.add(edit);
+  var plan = planner.extractPlanFromConstraints(edits);
+  for (var i = 0; i < 10; i++) {
+    v.value = newValue;
+    plan.execute();
+  }
+  edit.destroyConstraint();
+}
+
+// Global variable holding the current planner.
+var planner = null;
+
+function deltaBlue() {
+  chainTest(100);
+  projectionTest(100);
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/Field.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/Field.java
new file mode 100644
index 0000000..8d44cea
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/Field.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.navierstokes.gwt;
+
+public class Field {
+
+  private double[] dens;
+  private double[] u;
+  private double[] v;
+  private int rowSize;
+
+  public Field(double[] dens, double[] u, double[] v, int rowSize) {
+    this.dens = dens;
+    this.u = u;
+    this.v = v;
+    this.rowSize = rowSize;
+  }
+
+  public void setDensity(int x, int y, double d) {
+    dens[(x + 1) + (y + 1) * rowSize] = d;
+  }
+
+  public double getDensity(int x, int y) {
+    return dens[(x + 1) + (y + 1) * rowSize];
+  }
+
+  public void setVelocity(int x, int y, double xv, double yv) {
+    u[(x + 1) + (y + 1) * rowSize] = xv;
+    v[(x + 1) + (y + 1) * rowSize] = yv;
+  }
+
+  public double getXVelocity(int x, int y) {
+    return u[(x + 1) + (y + 1) * rowSize];
+  }
+
+  public double getYVelocity(int x, int y) {
+    return v[(x + 1) + (y + 1) * rowSize];
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/FluidField.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/FluidField.java
new file mode 100644
index 0000000..a2abd5d
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/FluidField.java
@@ -0,0 +1,336 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.navierstokes.gwt;
+
+
+public class FluidField {
+
+  public FluidField() {
+    setResolution(64, 64);
+  }
+
+  private void addFields(double[] x, double[] s, double dt) {
+    for (int i = 0; i < size; i++) {
+      x[i] += dt * s[i];
+    }
+  }
+
+  private void set_bnd(int b, double[] x) {
+    if (b == 1) {
+      for (int i = 1; i <= width; i++) {
+        x[i] = x[i + rowSize];
+        x[i + (height + 1) * rowSize] = x[i + height * rowSize];
+      }
+
+      for (int j = 1; j <= height; j++) {
+        x[j * rowSize] = -x[1 + j * rowSize];
+        x[(width + 1) + j * rowSize] = -x[width + j * rowSize];
+      }
+    } else if (b == 2) {
+      for (int i = 1; i <= width; i++) {
+        x[i] = -x[i + rowSize];
+        x[i + (height + 1) * rowSize] = -x[i + height * rowSize];
+      }
+
+      for (int j = 1; j <= height; j++) {
+        x[j * rowSize] = x[1 + j * rowSize];
+        x[(width + 1) + j * rowSize] = x[width + j * rowSize];
+      }
+    } else {
+      for (int i = 1; i <= width; i++) {
+        x[i] = x[i + rowSize];
+        x[i + (height + 1) * rowSize] = x[i + height * rowSize];
+      }
+
+      for (int j = 1; j <= height; j++) {
+        x[j * rowSize] = x[1 + j * rowSize];
+        x[(width + 1) + j * rowSize] = x[width + j * rowSize];
+      }
+    }
+    int maxEdge = (height + 1) * rowSize;
+    x[0] = 0.5 * (x[1] + x[rowSize]);
+    x[maxEdge] = 0.5 * (x[1 + maxEdge] + x[height * rowSize]);
+    x[(width + 1)] = 0.5 * (x[width] + x[(width + 1) + rowSize]);
+    x[(width + 1) + maxEdge] = 0.5 * (x[width + maxEdge] + x[(width + 1) + height * rowSize]);
+  }
+
+  private void lin_solve(int b, double[] x, double[] x0, int a, int c) {
+    if (a == 0 && c == 1) {
+      for (int j = 1; j <= height; j++) {
+        int currentRow = j * rowSize;
+        ++currentRow;
+        for (int i = 0; i < width; i++) {
+          x[currentRow] = x0[currentRow];
+          ++currentRow;
+        }
+      }
+      set_bnd(b, x);
+    } else {
+      double invC = 1 / c;
+      for (int k = 0; k < iterations; k++) {
+        for (int j = 1; j <= height; j++) {
+          int lastRow = (j - 1) * rowSize;
+          int currentRow = j * rowSize;
+          int nextRow = (j + 1) * rowSize;
+          double lastX = x[currentRow];
+          ++currentRow;
+          for (int i = 1; i <= width; i++)
+            lastX = x[currentRow] =
+                (x0[currentRow] + a * (lastX + x[++currentRow] + x[++lastRow] + x[++nextRow]))
+                * invC;
+        }
+        set_bnd(b, x);
+      }
+    }
+  }
+
+  private void diffuse(int b, double[] x, double[] x0, @SuppressWarnings("unused") double dt) {
+    int a = 0;
+    lin_solve(b, x, x0, a, 1 + 4 * a);
+  }
+
+  private void lin_solve2(double[] x, double[] x0, double[] y, double[] y0, int a, int c) {
+    if (a == 0 && c == 1) {
+      for (int j = 1; j <= height; j++) {
+        int currentRow = j * rowSize;
+        ++currentRow;
+        for (int i = 0; i < width; i++) {
+          x[currentRow] = x0[currentRow];
+          y[currentRow] = y0[currentRow];
+          ++currentRow;
+        }
+      }
+      set_bnd(1, x);
+      set_bnd(2, y);
+    } else {
+      double invC = 1 / c;
+      for (int k = 0; k < iterations; k++) {
+        for (int j = 1; j <= height; j++) {
+          int lastRow = (j - 1) * rowSize;
+          int currentRow = j * rowSize;
+          int nextRow = (j + 1) * rowSize;
+          double lastX = x[currentRow];
+          double lastY = y[currentRow];
+          ++currentRow;
+          for (int i = 1; i <= width; i++) {
+            lastX = x[currentRow] =
+                (x0[currentRow] + a * (lastX + x[currentRow] + x[lastRow] + x[nextRow])) * invC;
+            lastY = y[currentRow] =
+                (y0[currentRow] + a * (lastY + y[++currentRow] + y[++lastRow] + y[++nextRow]))
+                * invC;
+          }
+        }
+        set_bnd(1, x);
+        set_bnd(2, y);
+      }
+    }
+  }
+
+  private void diffuse2(double[] x, double[] x0, double[] y, double[] y0, @SuppressWarnings("unused") double dt) {
+    int a = 0;
+    lin_solve2(x, x0, y, y0, a, 1 + 4 * a);
+  }
+
+  private void advect(int b, double[] d, double[] d0, double[] u, double[] v, double dt) {
+    double Wdt0 = dt * width;
+    double Hdt0 = dt * height;
+    double Wp5 = width + 0.5;
+    double Hp5 = height + 0.5;
+    for (int j = 1; j <= height; j++) {
+      int pos = j * rowSize;
+      for (int i = 1; i <= width; i++) {
+        double x = i - Wdt0 * u[++pos];
+        double y = j - Hdt0 * v[pos];
+        if (x < 0.5)
+          x = 0.5;
+        else if (x > Wp5)
+          x = Wp5;
+        int i0 = (int)x;
+        int i1 = i0 + 1;
+        if (y < 0.5)
+          y = 0.5;
+        else if (y > Hp5)
+          y = Hp5;
+        int j0 = (int)y;
+        int j1 = j0 + 1;
+        double s1 = x - i0;
+        double s0 = 1 - s1;
+        double t1 = y - j0;
+        double t0 = 1 - t1;
+        int row1 = j0 * rowSize;
+        int row2 = j1 * rowSize;
+        d[pos] = s0 * (t0 * d0[i0 + row1] + t1 * d0[i0 + row2]) + s1
+            * (t0 * d0[i1 + row1] + t1 * d0[i1 + row2]);
+      }
+    }
+    set_bnd(b, d);
+  }
+
+  private void project(double[] u, double[] v, double[] p, double[] div) {
+    double h = -0.5 / Math.sqrt(width * height);
+    for (int j = 1; j <= height; j++) {
+      int row = j * rowSize;
+      int previousRow = (j - 1) * rowSize;
+      int prevValue = row - 1;
+      int currentRow = row;
+      int nextValue = row + 1;
+      int nextRow = (j + 1) * rowSize;
+      for (int i = 1; i <= width; i++) {
+        div[++currentRow] = h * (u[++nextValue] - u[++prevValue] + v[++nextRow] - v[++previousRow]);
+        p[currentRow] = 0;
+      }
+    }
+    set_bnd(0, div);
+    set_bnd(0, p);
+
+    lin_solve(0, p, div, 1, 4);
+    double wScale = 0.5 * width;
+    double hScale = 0.5 * height;
+    for (int j = 1; j <= height; j++) {
+      int prevPos = j * rowSize - 1;
+      int currentPos = j * rowSize;
+      int nextPos = j * rowSize + 1;
+      int prevRow = (j - 1) * rowSize;
+      @SuppressWarnings("unused")
+      int currentRow = j * rowSize;
+      int nextRow = (j + 1) * rowSize;
+
+      for (int i = 1; i <= width; i++) {
+        u[++currentPos] -= wScale * (p[++nextPos] - p[++prevPos]);
+        v[currentPos] -= hScale * (p[++nextRow] - p[++prevRow]);
+      }
+    }
+    set_bnd(1, u);
+    set_bnd(2, v);
+  }
+
+  private void dens_step(double[] x, double[] x0, double[] u, double[] v, double dt) {
+    addFields(x, x0, dt);
+    diffuse(0, x0, x, dt);
+    advect(0, x, x0, u, v, dt);
+  }
+
+  private void vel_step(double[] u, double[] v, double[] u0, double[] v0, double dt) {
+    addFields(u, u0, dt);
+    addFields(v, v0, dt);
+    double[] temp = u0;
+    u0 = u;
+    u = temp;
+    temp = v0;
+    v0 = v;
+    v = temp;
+    diffuse2(u, u0, v, v0, dt);
+    project(u, v, u0, v0);
+    temp = u0;
+    u0 = u;
+    u = temp;
+    temp = v0;
+    v0 = v;
+    v = temp;
+    advect(1, u, u0, u0, v0, dt);
+    advect(2, v, v0, u0, v0, dt);
+    project(u, v, u0, v0);
+  }
+
+  // var displayFunc;
+
+  private void queryUI(double[] d, double[] u, double[] v) {
+    for (int i = 0; i < size; i++) {
+      u[i] = v[i] = d[i] = 0.0;
+    }
+
+    uiCallback.prepareFrame(new Field(d, u, v, rowSize));
+  }
+
+  public void update() {
+    queryUI(dens_prev, u_prev, v_prev);
+    vel_step(u, v, u_prev, v_prev, dt);
+    dens_step(dens, dens_prev, u, v, dt);
+    displayFunc.call(new Field(dens, u, v, rowSize));
+  }
+
+  public interface DisplayFunction {
+    void call(Field f);
+  }
+
+  public void setDisplayFunction(DisplayFunction func) {
+    displayFunc = func;
+  }
+
+  private int iterations() {
+    return iterations;
+  }
+
+  public void setIterations(int iters) {
+    if (iters > 0 && iters <= 100) {
+      iterations = iters;
+    }
+  }
+
+  public interface UICallback {
+    void prepareFrame(Field field);
+  }
+
+  public void setUICallback(UICallback callback) {
+    uiCallback = callback;
+  }
+
+  private int iterations = 10;
+  private double visc = 0.5;
+  private double dt = 0.1;
+  private double[] dens;
+  private double[] dens_prev;
+  private double[] u;
+  private double[] u_prev;
+  private double[] v;
+  private double[] v_prev;
+  private int width;
+  private int height;
+  private int rowSize;
+  private int size;
+  private UICallback uiCallback;
+  private DisplayFunction displayFunc;
+
+  public void reset() {
+    rowSize = width + 2;
+    size = (width + 2) * (height + 2);
+    dens = new double[size];
+    dens_prev = new double[size];
+    u = new double[size];
+    u_prev = new double[size];
+    v = new double[size];
+    v_prev = new double[size];
+    // Change from original:
+    // Do not need to null this!
+    // for (var i = 0; i < size; i++)
+    // dens_prev[i] = u_prev[i] = v_prev[i] = dens[i] = u[i] = v[i] = 0;
+  }
+
+  public double[] getDens() {
+    return dens;
+  }
+
+  public boolean setResolution(int hRes, int wRes) {
+    int res = wRes * hRes;
+    if (res > 0 && res < 1000000 && (wRes != width || hRes != height)) {
+      width = wRes;
+      height = hRes;
+      reset();
+      return true;
+    }
+    return false;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/NavierStokes.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/NavierStokes.java
new file mode 100644
index 0000000..655ce9d
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/NavierStokes.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.navierstokes.gwt;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.navierstokes.gwt.FluidField.DisplayFunction;
+
+public class NavierStokes implements FluidField.UICallback, DisplayFunction {
+  private FluidField solver = null;
+  int nsFrameCounter = 0;
+
+  public void runNavierStokes() {
+    solver.update();
+    nsFrameCounter++;
+
+    if (nsFrameCounter == 15) {
+      checkResult(solver.getDens());
+    }
+
+  }
+
+  public void checkResult(double[] dens) {
+
+    int result = 0;
+    for (int i = 7000; i < 7100; i++) {
+      result += dens[i] * 10;
+    }
+
+    if (result != 77) {
+      throw new RuntimeException("checksum failed " + result);
+    }
+  }
+
+  public void setupNavierStokes() {
+    framesTillAddingPoints = 0;
+    framesBetweenAddingPoints = 5;
+
+    solver = new FluidField();
+    solver.setResolution(128, 128);
+    solver.setIterations(20);
+    solver.setUICallback(this);
+    solver.setDisplayFunction(this);
+    solver.reset();
+  }
+
+  public void tearDownNavierStokes() {
+    solver = null;
+  }
+
+  public void addPoints(Field field) {
+    int n = 64;
+    for (int i = 1; i <= n; i++) {
+      field.setVelocity(i, i, n, n);
+      field.setDensity(i, i, 5);
+      field.setVelocity(i, n - i, -n, -n);
+      field.setDensity(i, n - i, 20);
+      field.setVelocity(128 - i, n + i, -n, -n);
+      field.setDensity(128 - i, n + i, 30);
+    }
+  }
+
+  int framesTillAddingPoints = 0;
+  int framesBetweenAddingPoints = 5;
+
+  public void prepareFrame(Field field) {
+    if (framesTillAddingPoints == 0) {
+      addPoints(field);
+      framesTillAddingPoints = framesBetweenAddingPoints;
+      framesBetweenAddingPoints++;
+    } else {
+      framesTillAddingPoints--;
+    }
+  }
+
+  public void call(Field f) {
+
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/NavierStokesBenchmarkGWT.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/NavierStokesBenchmarkGWT.java
new file mode 100644
index 0000000..14a4613
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/gwt/NavierStokesBenchmarkGWT.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.navierstokes.gwt;
+
+import com.google.gwt.benchmark.framework.client.AbstractBenchmarkEntryPoint;
+import com.google.gwt.benchmark.framework.shared.AbstractBenchmark;
+
+public class NavierStokesBenchmarkGWT extends AbstractBenchmark {
+
+  public static class EntryPoint extends AbstractBenchmarkEntryPoint {
+
+    @Override
+    protected AbstractBenchmark getBenchmark() {
+      return new NavierStokesBenchmarkGWT();
+    }
+  }
+
+  private NavierStokes navierStokes;
+
+  public NavierStokesBenchmarkGWT() {
+    super("NavierStokesBenchmarkGWT");
+  }
+
+  @Override
+  public Object run() {
+    navierStokes.runNavierStokes();
+    return null;
+  }
+
+  @Override
+  public void setupOneTime() {
+    navierStokes = new NavierStokes();
+    navierStokes.setupNavierStokes();
+  }
+
+  @Override
+  public void tearDownOneTime() {
+    navierStokes.tearDownNavierStokes();
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/js/NavierStokesJsBenchmark.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/js/NavierStokesJsBenchmark.java
new file mode 100644
index 0000000..141bf51
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/js/NavierStokesJsBenchmark.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.navierstokes.js;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.OctaneJS;
+import com.google.gwt.benchmark.framework.client.AbstractBenchmarkEntryPoint;
+import com.google.gwt.benchmark.framework.client.Injector;
+import com.google.gwt.benchmark.framework.client.Injector.GlobalMapping;
+import com.google.gwt.benchmark.framework.shared.AbstractBenchmark;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.TextResource;
+
+public class NavierStokesJsBenchmark extends AbstractBenchmark {
+
+  public static class EntryPoint extends AbstractBenchmarkEntryPoint {
+
+    @Override
+    protected AbstractBenchmark getBenchmark() {
+      return new NavierStokesJsBenchmark();
+    }
+  }
+
+  interface Resource extends ClientBundle {
+    @Source("navier-stokes.js")
+    TextResource navierStokesJavaScript();
+  }
+
+  public NavierStokesJsBenchmark() {
+    super("NavierStokesBenchmarkJS");
+  }
+
+  @Override
+  public native Object run() /*-{
+    return $wnd.__octane__navierstokes_js_run();
+  }-*/;
+
+  @Override
+  public void setupOneTime() {
+    Resource r = GWT.create(Resource.class);
+
+    new Injector().injectJavaScript(OctaneJS.PREAMBLE + r.navierStokesJavaScript().getText(),
+        new GlobalMapping("__octane__navierstokes_js_run", "runNavierStokes"),
+        new GlobalMapping("__octane__navierstokes_js_setup", "setupNavierStokes"),
+        new GlobalMapping("__octane__navierstokes_js_teardown", "tearDownNavierStokes"));
+
+    callSetup();
+  }
+
+  @Override
+  public native void tearDownOneTime() /*-{
+    $wnd.__octane__navierstokes_js_teardown();
+  }-*/;
+
+  private native void callSetup() /*-{
+    $wnd.__octane__navierstokes_js_setup();
+  }-*/;
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/js/navier-stokes.js b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/js/navier-stokes.js
new file mode 100644
index 0000000..4fc5dfe
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/navierstokes/js/navier-stokes.js
@@ -0,0 +1,416 @@
+/**
+ * Copyright 2013 the V8 project authors. All rights reserved.
+ * Copyright 2009 Oliver Hunt <http://nerget.com>
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Update 10/21/2013: fixed loop variables at line 119
+ */
+
+var NavierStokes = new BenchmarkSuite('NavierStokes', [1484000],
+                                      [new Benchmark('NavierStokes',
+                                                     true,
+                                                     false,
+                                                     180,
+                                                     runNavierStokes,
+                                                     setupNavierStokes,
+                                                     tearDownNavierStokes,
+                                                     null,
+                                                     16)]);
+
+var solver = null;
+var nsFrameCounter = 0;
+
+function runNavierStokes()
+{
+    solver.update();
+    nsFrameCounter++;
+
+    if(nsFrameCounter==15)
+        checkResult(solver.getDens());
+}
+
+function checkResult(dens) {
+
+    this.result = 0;
+    for (var i=7000;i<7100;i++) {
+        this.result+=~~((dens[i]*10));
+    }
+
+    if (this.result!=77) {
+        throw(new Error("checksum failed " + this.result));
+    }
+}
+
+function setupNavierStokes()
+{
+    solver = new FluidField(null);
+    solver.setResolution(128, 128);
+    solver.setIterations(20);
+    solver.setDisplayFunction(function(){});
+    solver.setUICallback(prepareFrame);
+    solver.reset();
+}
+
+function tearDownNavierStokes()
+{
+    solver = null;
+}
+
+function addPoints(field) {
+    var n = 64;
+    for (var i = 1; i <= n; i++) {
+        field.setVelocity(i, i, n, n);
+        field.setDensity(i, i, 5);
+        field.setVelocity(i, n - i, -n, -n);
+        field.setDensity(i, n - i, 20);
+        field.setVelocity(128 - i, n + i, -n, -n);
+        field.setDensity(128 - i, n + i, 30);
+    }
+}
+
+var framesTillAddingPoints = 0;
+var framesBetweenAddingPoints = 5;
+
+function prepareFrame(field)
+{
+    if (framesTillAddingPoints == 0) {
+        addPoints(field);
+        framesTillAddingPoints = framesBetweenAddingPoints;
+        framesBetweenAddingPoints++;
+    } else {
+        framesTillAddingPoints--;
+    }
+}
+
+// Code from Oliver Hunt (http://nerget.com/fluidSim/pressure.js) starts here.
+function FluidField(canvas) {
+    function addFields(x, s, dt)
+    {
+        for (var i=0; i<size ; i++ ) x[i] += dt*s[i];
+    }
+
+    function set_bnd(b, x)
+    {
+        if (b===1) {
+            for (var i = 1; i <= width; i++) {
+                x[i] =  x[i + rowSize];
+                x[i + (height+1) *rowSize] = x[i + height * rowSize];
+            }
+
+            for (var j = 1; j <= height; j++) {
+                x[j * rowSize] = -x[1 + j * rowSize];
+                x[(width + 1) + j * rowSize] = -x[width + j * rowSize];
+            }
+        } else if (b === 2) {
+            for (var i = 1; i <= width; i++) {
+                x[i] = -x[i + rowSize];
+                x[i + (height + 1) * rowSize] = -x[i + height * rowSize];
+            }
+
+            for (var j = 1; j <= height; j++) {
+                x[j * rowSize] =  x[1 + j * rowSize];
+                x[(width + 1) + j * rowSize] =  x[width + j * rowSize];
+            }
+        } else {
+            for (var i = 1; i <= width; i++) {
+                x[i] =  x[i + rowSize];
+                x[i + (height + 1) * rowSize] = x[i + height * rowSize];
+            }
+
+            for (var j = 1; j <= height; j++) {
+                x[j * rowSize] =  x[1 + j * rowSize];
+                x[(width + 1) + j * rowSize] =  x[width + j * rowSize];
+            }
+        }
+        var maxEdge = (height + 1) * rowSize;
+        x[0]                 = 0.5 * (x[1] + x[rowSize]);
+        x[maxEdge]           = 0.5 * (x[1 + maxEdge] + x[height * rowSize]);
+        x[(width+1)]         = 0.5 * (x[width] + x[(width + 1) + rowSize]);
+        x[(width+1)+maxEdge] = 0.5 * (x[width + maxEdge] + x[(width + 1) + height * rowSize]);
+    }
+
+    function lin_solve(b, x, x0, a, c)
+    {
+        if (a === 0 && c === 1) {
+            for (var j=1 ; j<=height; j++) {
+                var currentRow = j * rowSize;
+                ++currentRow;
+                for (var i = 0; i < width; i++) {
+                    x[currentRow] = x0[currentRow];
+                    ++currentRow;
+                }
+            }
+            set_bnd(b, x);
+        } else {
+            var invC = 1 / c;
+            for (var k=0 ; k<iterations; k++) {
+                for (var j=1 ; j<=height; j++) {
+                    var lastRow = (j - 1) * rowSize;
+                    var currentRow = j * rowSize;
+                    var nextRow = (j + 1) * rowSize;
+                    var lastX = x[currentRow];
+                    ++currentRow;
+                    for (var i=1; i<=width; i++)
+                        lastX = x[currentRow] = (x0[currentRow] + a*(lastX+x[++currentRow]+x[++lastRow]+x[++nextRow])) * invC;
+                }
+                set_bnd(b, x);
+            }
+        }
+    }
+
+    function diffuse(b, x, x0, dt)
+    {
+        var a = 0;
+        lin_solve(b, x, x0, a, 1 + 4*a);
+    }
+
+    function lin_solve2(x, x0, y, y0, a, c)
+    {
+        if (a === 0 && c === 1) {
+            for (var j=1 ; j <= height; j++) {
+                var currentRow = j * rowSize;
+                ++currentRow;
+                for (var i = 0; i < width; i++) {
+                    x[currentRow] = x0[currentRow];
+                    y[currentRow] = y0[currentRow];
+                    ++currentRow;
+                }
+            }
+            set_bnd(1, x);
+            set_bnd(2, y);
+        } else {
+            var invC = 1/c;
+            for (var k=0 ; k<iterations; k++) {
+                for (var j=1 ; j <= height; j++) {
+                    var lastRow = (j - 1) * rowSize;
+                    var currentRow = j * rowSize;
+                    var nextRow = (j + 1) * rowSize;
+                    var lastX = x[currentRow];
+                    var lastY = y[currentRow];
+                    ++currentRow;
+                    for (var i = 1; i <= width; i++) {
+                        lastX = x[currentRow] = (x0[currentRow] + a * (lastX + x[currentRow] + x[lastRow] + x[nextRow])) * invC;
+                        lastY = y[currentRow] = (y0[currentRow] + a * (lastY + y[++currentRow] + y[++lastRow] + y[++nextRow])) * invC;
+                    }
+                }
+                set_bnd(1, x);
+                set_bnd(2, y);
+            }
+        }
+    }
+
+    function diffuse2(x, x0, y, y0, dt)
+    {
+        var a = 0;
+        lin_solve2(x, x0, y, y0, a, 1 + 4 * a);
+    }
+
+    function advect(b, d, d0, u, v, dt)
+    {
+        var Wdt0 = dt * width;
+        var Hdt0 = dt * height;
+        var Wp5 = width + 0.5;
+        var Hp5 = height + 0.5;
+        for (var j = 1; j<= height; j++) {
+            var pos = j * rowSize;
+            for (var i = 1; i <= width; i++) {
+                var x = i - Wdt0 * u[++pos];
+                var y = j - Hdt0 * v[pos];
+                if (x < 0.5)
+                    x = 0.5;
+                else if (x > Wp5)
+                    x = Wp5;
+                var i0 = x | 0;
+                var i1 = i0 + 1;
+                if (y < 0.5)
+                    y = 0.5;
+                else if (y > Hp5)
+                    y = Hp5;
+                var j0 = y | 0;
+                var j1 = j0 + 1;
+                var s1 = x - i0;
+                var s0 = 1 - s1;
+                var t1 = y - j0;
+                var t0 = 1 - t1;
+                var row1 = j0 * rowSize;
+                var row2 = j1 * rowSize;
+                d[pos] = s0 * (t0 * d0[i0 + row1] + t1 * d0[i0 + row2]) + s1 * (t0 * d0[i1 + row1] + t1 * d0[i1 + row2]);
+            }
+        }
+        set_bnd(b, d);
+    }
+
+    function project(u, v, p, div)
+    {
+        var h = -0.5 / Math.sqrt(width * height);
+        for (var j = 1 ; j <= height; j++ ) {
+            var row = j * rowSize;
+            var previousRow = (j - 1) * rowSize;
+            var prevValue = row - 1;
+            var currentRow = row;
+            var nextValue = row + 1;
+            var nextRow = (j + 1) * rowSize;
+            for (var i = 1; i <= width; i++ ) {
+                div[++currentRow] = h * (u[++nextValue] - u[++prevValue] + v[++nextRow] - v[++previousRow]);
+                p[currentRow] = 0;
+            }
+        }
+        set_bnd(0, div);
+        set_bnd(0, p);
+
+        lin_solve(0, p, div, 1, 4 );
+        var wScale = 0.5 * width;
+        var hScale = 0.5 * height;
+        for (var j = 1; j<= height; j++ ) {
+            var prevPos = j * rowSize - 1;
+            var currentPos = j * rowSize;
+            var nextPos = j * rowSize + 1;
+            var prevRow = (j - 1) * rowSize;
+            var currentRow = j * rowSize;
+            var nextRow = (j + 1) * rowSize;
+
+            for (var i = 1; i<= width; i++) {
+                u[++currentPos] -= wScale * (p[++nextPos] - p[++prevPos]);
+                v[currentPos]   -= hScale * (p[++nextRow] - p[++prevRow]);
+            }
+        }
+        set_bnd(1, u);
+        set_bnd(2, v);
+    }
+
+    function dens_step(x, x0, u, v, dt)
+    {
+        addFields(x, x0, dt);
+        diffuse(0, x0, x, dt );
+        advect(0, x, x0, u, v, dt );
+    }
+
+    function vel_step(u, v, u0, v0, dt)
+    {
+        addFields(u, u0, dt );
+        addFields(v, v0, dt );
+        var temp = u0; u0 = u; u = temp;
+        var temp = v0; v0 = v; v = temp;
+        diffuse2(u,u0,v,v0, dt);
+        project(u, v, u0, v0);
+        var temp = u0; u0 = u; u = temp;
+        var temp = v0; v0 = v; v = temp;
+        advect(1, u, u0, u0, v0, dt);
+        advect(2, v, v0, u0, v0, dt);
+        project(u, v, u0, v0 );
+    }
+    var uiCallback = function(d,u,v) {};
+
+    function Field(dens, u, v) {
+        // Just exposing the fields here rather than using accessors is a measurable win during display (maybe 5%)
+        // but makes the code ugly.
+        this.setDensity = function(x, y, d) {
+             dens[(x + 1) + (y + 1) * rowSize] = d;
+        }
+        this.getDensity = function(x, y) {
+             return dens[(x + 1) + (y + 1) * rowSize];
+        }
+        this.setVelocity = function(x, y, xv, yv) {
+             u[(x + 1) + (y + 1) * rowSize] = xv;
+             v[(x + 1) + (y + 1) * rowSize] = yv;
+        }
+        this.getXVelocity = function(x, y) {
+             return u[(x + 1) + (y + 1) * rowSize];
+        }
+        this.getYVelocity = function(x, y) {
+             return v[(x + 1) + (y + 1) * rowSize];
+        }
+        this.width = function() { return width; }
+        this.height = function() { return height; }
+    }
+    function queryUI(d, u, v)
+    {
+        for (var i = 0; i < size; i++)
+            u[i] = v[i] = d[i] = 0.0;
+        uiCallback(new Field(d, u, v));
+    }
+
+    this.update = function () {
+        queryUI(dens_prev, u_prev, v_prev);
+        vel_step(u, v, u_prev, v_prev, dt);
+        dens_step(dens, dens_prev, u, v, dt);
+        displayFunc(new Field(dens, u, v));
+    }
+    this.setDisplayFunction = function(func) {
+        displayFunc = func;
+    }
+
+    this.iterations = function() { return iterations; }
+    this.setIterations = function(iters) {
+        if (iters > 0 && iters <= 100)
+           iterations = iters;
+    }
+    this.setUICallback = function(callback) {
+        uiCallback = callback;
+    }
+    var iterations = 10;
+    var visc = 0.5;
+    var dt = 0.1;
+    var dens;
+    var dens_prev;
+    var u;
+    var u_prev;
+    var v;
+    var v_prev;
+    var width;
+    var height;
+    var rowSize;
+    var size;
+    var displayFunc;
+    function reset()
+    {
+        rowSize = width + 2;
+        size = (width+2)*(height+2);
+        dens = new Array(size);
+        dens_prev = new Array(size);
+        u = new Array(size);
+        u_prev = new Array(size);
+        v = new Array(size);
+        v_prev = new Array(size);
+        for (var i = 0; i < size; i++)
+            dens_prev[i] = u_prev[i] = v_prev[i] = dens[i] = u[i] = v[i] = 0;
+    }
+    this.reset = reset;
+    this.getDens = function()
+    {
+        return dens;
+    }
+    this.setResolution = function (hRes, wRes)
+    {
+        var res = wRes * hRes;
+        if (res > 0 && res < 1000000 && (wRes != width || hRes != height)) {
+            width = wRes;
+            height = hRes;
+            reset();
+            return true;
+        }
+        return false;
+    }
+    this.setResolution(64, 64);
+}
+
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Background.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Background.java
new file mode 100644
index 0000000..3a2dc3b
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Background.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Background {
+
+  private Color color;
+  private double ambience;
+
+  public Background(Color color, double ambience) {
+    this.color = color;
+    this.ambience = ambience;
+  }
+
+  public Color getColor() {
+    return color;
+  }
+
+  public double getAmbience() {
+    return ambience;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/BaseMaterial.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/BaseMaterial.java
new file mode 100644
index 0000000..3cf64a7
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/BaseMaterial.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public abstract class BaseMaterial {
+  protected double gloss = 2.0;
+  protected double transparency = 0.0; // 0=opaque
+  protected double reflection = 0.0; // [0...infinity] 0 = no reflection
+  @SuppressWarnings("unused")
+  private double refraction = 0.50;
+  protected boolean hasTexture = false;
+
+  public abstract Color getColor(double u, double v);
+
+  public double wrapUp(double t) {
+    t = t % 2.0;
+    if (t < -1)
+      t += 2.0;
+    if (t >= 1)
+      t -= 2.0;
+    return t;
+  }
+
+  @Override
+  public String toString() {
+    return "Material [gloss=" + this.gloss + ", transparency=" + this.transparency + ", hasTexture="
+        + this.hasTexture + "]";
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Camera.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Camera.java
new file mode 100644
index 0000000..942f5bb
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Camera.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Camera {
+  private Vector position;
+  private Vector lookAt;
+  private Vector up;
+  private Vector equator;
+  private Vector screen;
+
+  public Camera(Vector pos, Vector lookAt, Vector up) {
+    this.position = pos;
+    this.lookAt = lookAt;
+    this.up = up;
+    this.equator = lookAt.normalize().cross(this.up);
+    this.screen = Vector.add(this.position, this.lookAt);
+  }
+
+  public Ray getRay(double vx, double vy) {
+    Vector pos = Vector.subtract(this.screen, Vector.subtract(
+        Vector.multiplyScalar(this.equator, vx), Vector.multiplyScalar(this.up, vy)));
+    pos.setY(pos.getY() * -1);
+    Vector dir = Vector.subtract(pos, this.position);
+
+    Ray ray = new Ray(pos, dir.normalize());
+
+    return ray;
+  }
+
+  @Override
+  public String toString() {
+    return "Ray []";
+  }
+
+  public Vector getPosition() {
+    return this.position;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Chessboard.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Chessboard.java
new file mode 100644
index 0000000..69be1b3
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Chessboard.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Chessboard extends BaseMaterial {
+  private double density;
+  private Color colorOdd;
+  private Color colorEven;
+
+  public Chessboard(Color colorEven, Color colorOdd, double reflection, double transparency,
+      double gloss, double density) {
+    this.colorEven = colorEven;
+    this.colorOdd = colorOdd;
+    this.reflection = reflection;
+    this.transparency = transparency;
+    this.gloss = gloss;
+    this.density = density;
+    this.hasTexture = true;
+  }
+
+  @Override
+  public Color getColor(double u, double v) {
+    double t = this.wrapUp(u * this.density) * this.wrapUp(v * this.density);
+
+    if (t < 0.0)
+      return this.colorEven;
+    else
+      return this.colorOdd;
+  }
+
+  @Override
+  public String toString() {
+    return "ChessMaterial [gloss=" + this.gloss + ", transparency=" + this.transparency
+        + ", hasTexture=" + this.hasTexture + "]";
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Color.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Color.java
new file mode 100644
index 0000000..bc78853
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Color.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Color {
+
+  private double red;
+  private double green;
+  private double blue;
+
+  public Color(double r, double g, double b) {
+    this.red = r;
+    this.green = g;
+    this.blue = b;
+  }
+
+  public static Color add(Color c1, Color c2) {
+    Color result = new Color(0, 0, 0);
+
+    result.red = c1.red + c2.red;
+    result.green = c1.green + c2.green;
+    result.blue = c1.blue + c2.blue;
+
+    return result;
+  }
+
+  public static Color addScalar(Color c1, double s) {
+    Color result = new Color(0, 0, 0);
+
+    result.red = c1.red + s;
+    result.green = c1.green + s;
+    result.blue = c1.blue + s;
+
+    result.limit();
+
+    return result;
+  }
+
+  public Color subtract(Color c1, Color c2) {
+    Color result = new Color(0, 0, 0);
+
+    result.red = c1.red - c2.red;
+    result.green = c1.green - c2.green;
+    result.blue = c1.blue - c2.blue;
+
+    return result;
+  }
+
+  public static Color multiply(Color c1, Color c2) {
+    Color result = new Color(0, 0, 0);
+
+    result.red = c1.red * c2.red;
+    result.green = c1.green * c2.green;
+    result.blue = c1.blue * c2.blue;
+
+    return result;
+  }
+
+  public static Color multiplyScalar(Color c1, double f) {
+    Color result = new Color(0, 0, 0);
+
+    result.red = c1.red * f;
+    result.green = c1.green * f;
+    result.blue = c1.blue * f;
+
+    return result;
+  }
+
+  public Color divideFactor(Color c1, double f) {
+    Color result = new Color(0, 0, 0);
+
+    result.red = c1.red / f;
+    result.green = c1.green / f;
+    result.blue = c1.blue / f;
+
+    return result;
+  }
+
+  public void limit() {
+    this.red = (this.red > 0.0) ? ((this.red > 1.0) ? 1.0 : this.red) : 0.0;
+    this.green = (this.green > 0.0) ? ((this.green > 1.0) ? 1.0 : this.green) : 0.0;
+    this.blue = (this.blue > 0.0) ? ((this.blue > 1.0) ? 1.0 : this.blue) : 0.0;
+  }
+
+  public double distance(Color color) {
+    double d = Math.abs(this.red - color.red) + Math.abs(this.green - color.green)
+        + Math.abs(this.blue - color.blue);
+    return d;
+  }
+
+  public static Color blend(Color c1, Color c2, double w) {
+    Color result = new Color(0, 0, 0);
+    result = add(multiplyScalar(c1, 1 - w), multiplyScalar(c2, w));
+    return result;
+  }
+
+  public double brightness() {
+    int r = (int) Math.floor(this.red * 255);
+    int g = (int) Math.floor(this.green * 255);
+    int b = (int) Math.floor(this.blue * 255);
+    return (r * 77 + g * 150 + b * 29) >> 8;
+  }
+
+  @Override
+  public String toString() {
+    double r = Math.floor(this.red * 255);
+    double g = Math.floor(this.green * 255);
+    double b = Math.floor(this.blue * 255);
+
+    return "rgb(" + r + "," + g + "," + b + ")";
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Engine.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Engine.java
new file mode 100644
index 0000000..4bc94ae
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Engine.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Engine {
+
+  public static class Options {
+    public int canvasHeight = 100;
+    public int canvasWidth = 100;
+    public int pixelWidth = 2;
+    public int pixelHeight = 2;
+    public boolean renderDiffuse = false;
+    public boolean renderShadows = false;
+    public boolean renderHighlights = false;
+    public boolean renderReflections = false;
+    public int rayDepth = 2;
+  }
+
+  private Options options;
+  private Object canvas;
+
+  public Engine(Options options) {
+    this.options = options;
+    this.options.canvasHeight /= this.options.pixelHeight;
+    this.options.canvasWidth /= this.options.pixelWidth;
+  }
+
+  @SuppressWarnings("unused")
+  public void setPixel(double x, double y, Color color) {
+    double pxW, pxH;
+    pxW = this.options.pixelWidth;
+    pxH = this.options.pixelHeight;
+
+    if (this.canvas != null) {
+      // this.canvas.fillStyle = color.toString();
+      // this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH);
+    } else {
+      if (x == y) {
+        Global.checkNumber += color.brightness();
+      }
+      // print(x * pxW, y * pxH, pxW, pxH);
+    }
+  }
+
+  public void renderScene(Scene scene, Object canvas) {
+    Global.checkNumber = 0;
+    /* Get canvas */
+    if (canvas != null) {
+      // this.canvas = canvas.getContext("2d");
+    } else {
+      this.canvas = null;
+    }
+
+    double canvasHeight = this.options.canvasHeight;
+    double canvasWidth = this.options.canvasWidth;
+
+    for (int y = 0; y < canvasHeight; y++) {
+      for (int x = 0; x < canvasWidth; x++) {
+        double yp = y * 1.0 / canvasHeight * 2 - 1;
+        double xp = x * 1.0 / canvasWidth * 2 - 1;
+
+        Ray ray = scene.getCamera().getRay(xp, yp);
+
+        Color color = this.getPixelColor(ray, scene);
+
+        this.setPixel(x, y, color);
+      }
+    }
+    if (Global.checkNumber != 2321) {
+      throw new RuntimeException("Scene rendered incorrectly");
+    }
+  }
+
+  public Color getPixelColor(Ray ray, Scene scene) {
+    IntersectionInfo info = this.testIntersection(ray, scene, null);
+    if (info.isHit()) {
+      Color color = this.rayTrace(info, ray, scene, 0);
+      return color;
+    }
+    return scene.getBackground().getColor();
+  }
+
+  public IntersectionInfo testIntersection(Ray ray, Scene scene, Shape exclude) {
+    int hits = 0;
+    IntersectionInfo best = new IntersectionInfo();
+    best.setDistance(2000);
+
+    for (int i = 0; i < scene.getShapes().length(); i++) {
+      Shape shape = scene.getShapes().get(i);
+
+      if (shape != exclude) {
+        IntersectionInfo info = shape.intersect(ray);
+        if (info.isHit() && info.getDistance() >= 0 && info.getDistance() < best.getDistance()) {
+          best = info;
+          hits++;
+        }
+      }
+    }
+    best.setHitCount(hits);
+    return best;
+  }
+
+  public Ray getReflectionRay(Vector P, Vector N, Vector V) {
+    double c1 = -N.dot(V);
+    Vector R1 = Vector.add(Vector.multiplyScalar(N, 2 * c1), V);
+    return new Ray(P, R1);
+  }
+
+  public Color rayTrace(IntersectionInfo info, Ray ray, Scene scene, double depth) {
+    // Calc ambient
+    Color color = Color.multiplyScalar(info.getColor(), scene.getBackground().getAmbience());
+    @SuppressWarnings("unused")
+    Color oldColor = color;
+    double shininess = Math.pow(10, info.getShape().getMaterial().gloss + 1);
+
+    for (int i = 0; i < scene.getLights().length(); i++) {
+      Light light = scene.getLights().get(i);
+
+      // Calc diffuse lighting
+      Vector v = Vector.subtract(light.getPosition(), info.getPosition()).normalize();
+
+      if (this.options.renderDiffuse) {
+        double L = v.dot(info.getNormal());
+        if (L > 0.0) {
+          color = Color.add(color,
+              Color.multiply(info.getColor(), Color.multiplyScalar(light.getColor(), L)));
+        }
+      }
+
+      // The greater the depth the more accurate the colours, but
+      // this is exponentially (!) expensive
+      if (depth <= this.options.rayDepth) {
+        // calculate reflection ray
+        if (this.options.renderReflections && info.getShape().getMaterial().reflection > 0) {
+          Ray reflectionRay =
+              this.getReflectionRay(info.getPosition(), info.getNormal(), ray.getDirection());
+          IntersectionInfo refl = this.testIntersection(reflectionRay, scene, info.getShape());
+
+          if (refl.isHit() && refl.getDistance() > 0) {
+            refl.setColor(this.rayTrace(refl, reflectionRay, scene, depth + 1));
+          } else {
+            refl.setColor(scene.getBackground().getColor());
+          }
+
+          color = Color.blend(color, refl.getColor(), info.getShape().getMaterial().reflection);
+        }
+      }
+
+      /* Render shadows and highlights */
+
+      IntersectionInfo shadowInfo = new IntersectionInfo();
+
+      if (this.options.renderShadows) {
+        Ray shadowRay = new Ray(info.getPosition(), v);
+
+        shadowInfo = this.testIntersection(shadowRay, scene, info.getShape());
+        if (shadowInfo.isHit() && shadowInfo.getShape() != info.getShape() ) {
+          Color vA = Color.multiplyScalar(color, 0.5);
+          double dB = (0.5 * Math.pow(shadowInfo.getShape().getMaterial().transparency, 0.5));
+          color = Color.addScalar(vA, dB);
+        }
+      }
+
+      // Phong specular highlights
+      if (this.options.renderHighlights && !shadowInfo.isHit()
+          && info.getShape().getMaterial().gloss > 0) {
+        Vector Lv = Vector.subtract(info.getShape().getPosition(), light.getPosition()).normalize();
+
+        Vector E = Vector.subtract(scene.getCamera().getPosition(), info.getShape().getPosition())
+            .normalize();
+
+        Vector H = Vector.subtract(E, Lv).normalize();
+
+        double glossWeight = Math.pow(Math.max(info.getNormal().dot(H), 0), shininess);
+        color = Color.add(Color.multiplyScalar(light.getColor(), glossWeight), color);
+      }
+    }
+    color.limit();
+    return color;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Global.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Global.java
new file mode 100644
index 0000000..e9e316f
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Global.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Global {
+  public static int checkNumber = 0;
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/IntersectionInfo.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/IntersectionInfo.java
new file mode 100644
index 0000000..8f6e8e4
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/IntersectionInfo.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class IntersectionInfo {
+
+  private boolean isHit;
+  @SuppressWarnings("unused")
+  private int hitCount;
+  private Shape shape;
+  private Vector position;
+  private Vector normal;
+  private Color color;
+  private double distance;
+
+  public IntersectionInfo() {
+    this.color = new Color(0, 0, 0);
+  }
+
+  public void isHit(boolean b) {
+    this.isHit = b;
+  }
+
+  public void setDistance(double distance) {
+    this.distance = distance;
+  }
+
+  public void setShape(Shape shape) {
+    this.shape = shape;
+  }
+
+  public double getDistance() {
+    return this.distance;
+  }
+
+  public void setPosition(Vector position) {
+    this.position = position;
+  }
+
+  public Vector getPosition() {
+    return this.position;
+  }
+
+  public void setNormal(Vector normal) {
+    this.normal = normal;
+  }
+
+  public void setColor(Color color) {
+    this.color = color;
+  }
+
+  @Override
+  public String toString() {
+    return "Intersection [" + this.position + "]";
+  }
+
+  public boolean isHit() {
+    return isHit;
+  }
+
+  public void setHitCount(int hits) {
+    this.hitCount = hits;
+  }
+
+  public Color getColor() {
+    return color;
+  }
+
+  public Shape getShape() {
+    return shape;
+  }
+
+  public Vector getNormal() {
+    return normal;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Light.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Light.java
new file mode 100644
index 0000000..6562af6
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Light.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+
+public class Light {
+
+  private Vector position;
+  private Color color;
+  @SuppressWarnings("unused")
+  private double intensity;
+
+  public Light(Vector pos, Color color) {
+    this(pos, color, 10.0);
+  }
+
+  public Light(Vector pos, Color color, double intensity) {
+    this.position = pos;
+    this.color = color;
+    this.intensity = intensity;
+  }
+
+  @Override
+  public String toString() {
+    return "Light [" + this.position.getX() + "," + this.position.getY() + "," + this.position.getZ() + "]";
+  }
+
+  public Vector getPosition() {
+    return position;
+  }
+
+  public Color getColor() {
+    return color;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/MaterialSolid.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/MaterialSolid.java
new file mode 100644
index 0000000..bac7c5b
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/MaterialSolid.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class MaterialSolid extends BaseMaterial {
+
+  private Color color;
+
+  public MaterialSolid(Color color, double reflection,
+      @SuppressWarnings("unused") double refraction, double transparency, double gloss) {
+    this.color = color;
+    this.reflection = reflection;
+    this.transparency = transparency;
+    this.gloss = gloss;
+    this.hasTexture = false;
+  }
+
+  @Override
+  public Color getColor(double u, double v) {
+    return color;
+  }
+
+  @Override
+  public String toString() {
+    return "SolidMaterial [gloss=" + this.gloss + ", transparency=" + this.transparency
+        + ", hasTexture=" + this.hasTexture + "]";
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Plane.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Plane.java
new file mode 100644
index 0000000..f49c7c8
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Plane.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Plane extends Shape {
+  private Vector position;
+  private double d;
+  private BaseMaterial material;
+
+  public Plane(Vector pos, double d, BaseMaterial material) {
+    this.position = pos;
+    this.d = d;
+    this.material = material;
+  }
+
+  @Override
+  public IntersectionInfo intersect(Ray ray) {
+    IntersectionInfo info = new IntersectionInfo();
+
+    double Vd = this.position.dot(ray.getDirection());
+    if (Vd == 0)
+      return info; // no intersection
+
+    double t = -(this.position.dot(ray.getPosition()) + this.d) / Vd;
+    if (t <= 0)
+      return info;
+
+    info.setShape(this);
+    info.isHit(true);
+    info.setPosition(Vector.add(ray.getPosition(), Vector.multiplyScalar(ray.getDirection(), t)));
+    info.setNormal(this.position);
+    info.setDistance(t);
+
+    if (this.material.hasTexture) {
+      Vector vU = new Vector(this.position.getY(), this.position.getZ(), -this.position.getX());
+      Vector vV = vU.cross(this.position);
+      double u = info.getPosition().dot(vU);
+      double v = info.getPosition().dot(vV);
+      info.setColor(this.material.getColor(u, v));
+    } else {
+      info.setColor(this.material.getColor(0, 0));
+    }
+
+    return info;
+  }
+
+  @Override
+  public String toString() {
+    return "Plane [" + this.position + ", d=" + this.d + "]";
+  }
+
+  @Override
+  public BaseMaterial getMaterial() {
+    return material;
+  }
+
+  @Override
+  public Vector getPosition() {
+    return position;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Ray.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Ray.java
new file mode 100644
index 0000000..7cf4d82
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Ray.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Ray {
+
+  private Vector position;
+  private Vector direction;
+
+  public Ray(Vector pos, Vector dir) {
+    this.position = pos;
+    this.direction = dir;
+  }
+
+  @Override
+  public String toString() {
+    return "Ray [" + this.position + "," + this.direction + "]";
+  }
+
+  public Vector getPosition() {
+    return position;
+  }
+
+  public Vector getDirection() {
+    return direction;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/RayTrace.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/RayTrace.java
new file mode 100644
index 0000000..376ebe5
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/RayTrace.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt.Engine.Options;
+
+public class RayTrace {
+
+  public static void renderScene() {
+    Scene scene = new Scene();
+
+    scene.setCamera(new Camera(new Vector(0, 0, -15), new Vector(-0.2, 0, 5), new Vector(0, 1, 0)));
+
+    scene.setBackground(new Background(new Color(0.5, 0.5, 0.5), 0.4));
+
+    Sphere sphere = new Sphere(new Vector(-1.5, 1.5, 2), 1.5,
+        new MaterialSolid(new Color(0, 0.5, 0.5), 0.3, 0.0, 0.0, 2.0));
+
+    Sphere sphere1 = new Sphere(new Vector(1, 0.25, 1), 0.5,
+        new MaterialSolid(new Color(0.9, 0.9, 0.9), 0.1, 0.0, 0.0, 1.5));
+
+    Plane plane = new Plane(new Vector(0.1, 0.9, -0.5).normalize(), 1.2,
+        new Chessboard(new Color(1, 1, 1), new Color(0, 0, 0), 0.2, 0.0, 1.0, 0.7));
+
+    scene.getShapes().push(plane);
+    scene.getShapes().push(sphere);
+    scene.getShapes().push(sphere1);
+
+    Light light = new Light(new Vector(5, 10, -1), new Color(0.8, 0.8, 0.8));
+
+    Light light1 = new Light(new Vector(-3, 5, -15), new Color(0.8, 0.8, 0.8), 100);
+
+    scene.getLights().push(light);
+    scene.getLights().push(light1);
+
+    Options options = new Engine.Options();
+
+    options.canvasWidth = 100;
+    options.canvasHeight = 100;
+
+    options.pixelWidth = 5;
+    options.pixelHeight = 5;
+
+    options.renderDiffuse = true;
+    options.renderShadows = true;
+    options.renderHighlights = true;
+    options.renderReflections = true;
+    options.rayDepth = 2;
+
+    Engine raytracer = new Engine(options);
+
+    raytracer.renderScene(scene, null);
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/RayTraceBenchmark.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/RayTraceBenchmark.java
new file mode 100644
index 0000000..bd7b98f
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/RayTraceBenchmark.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+import com.google.gwt.benchmark.framework.client.AbstractBenchmarkEntryPoint;
+import com.google.gwt.benchmark.framework.shared.AbstractBenchmark;
+
+public class RayTraceBenchmark extends AbstractBenchmark {
+
+  /**
+   * EntryPoint for RaytraceGWT benchmark.
+   */
+  public static class EntryPoint extends AbstractBenchmarkEntryPoint {
+
+    @Override
+    protected AbstractBenchmark getBenchmark() {
+      return new RayTraceBenchmark();
+    }
+  }
+
+  public RayTraceBenchmark() {
+    super("Octane_raytrace_gwt");
+  }
+
+  @Override
+  public Object run() {
+    RayTrace.renderScene();
+    return null;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Scene.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Scene.java
new file mode 100644
index 0000000..389c2a7
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Scene.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+import com.google.gwt.benchmark.collection.shared.CollectionFactory;
+import com.google.gwt.benchmark.collection.shared.JavaScriptArray;
+
+
+public class Scene {
+
+  private Camera camera;
+  private JavaScriptArray<Shape> shapes;
+  private JavaScriptArray<Light> lights;
+  private Background background;
+
+  public Scene() {
+    this.camera = new Camera(
+        new Vector(0, 0, -5),
+        new Vector(0, 0, 1),
+        new Vector(0, 1, 0));
+    this.shapes = CollectionFactory.create();
+    this.lights = CollectionFactory.create();
+    this.background = new Background(new Color(0,0,0.5), 0.2);
+  }
+
+  public Camera getCamera() {
+    return camera;
+  }
+
+  public Background getBackground() {
+    return background;
+  }
+
+  public JavaScriptArray<Shape> getShapes() {
+    return shapes;
+  }
+
+  public JavaScriptArray<Light> getLights() {
+    return lights;
+  }
+
+  public void setCamera(Camera camera) {
+    this.camera = camera;
+  }
+
+  public void setBackground(Background background) {
+    this.background = background;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Shape.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Shape.java
new file mode 100644
index 0000000..93c8eea
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Shape.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public abstract class Shape {
+  public abstract IntersectionInfo intersect(Ray ray);
+
+  public abstract BaseMaterial getMaterial();
+
+  public abstract Vector getPosition();
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Sphere.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Sphere.java
new file mode 100644
index 0000000..fa1b99d
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Sphere.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Sphere extends Shape {
+
+  private double radius;
+  private Vector position;
+  private BaseMaterial material;
+
+  public Sphere(Vector pos, double radius, BaseMaterial material) {
+    this.radius = radius;
+    this.position = pos;
+    this.material = material;
+  }
+
+  @Override
+  public IntersectionInfo intersect(Ray ray) {
+    IntersectionInfo info = new IntersectionInfo();
+    info.setShape(this);
+
+    Vector dst = Vector.subtract(ray.getPosition(), this.position);
+
+    double B = dst.dot(ray.getDirection());
+    double C = dst.dot(dst) - (this.radius * this.radius);
+    double D = (B * B) - C;
+
+    if (D > 0) { // intersection!
+      info.isHit(true);
+      info.setDistance((-B) - Math.sqrt(D));
+      info.setPosition(Vector.add(ray.getPosition(),
+          Vector.multiplyScalar(ray.getDirection(), info.getDistance())));
+
+      info.setNormal(Vector.subtract(info.getPosition(), this.position).normalize());
+
+      info.setColor(this.material.getColor(0, 0));
+    } else {
+      info.isHit(false);
+    }
+    return info;
+  }
+
+  @Override
+  public BaseMaterial getMaterial() {
+    return material;
+  }
+
+  @Override
+  public Vector getPosition() {
+    return this.position;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Vector.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Vector.java
new file mode 100644
index 0000000..4de043a
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/gwt/Vector.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.gwt;
+
+public class Vector {
+  private double x;
+  private double y;
+  private double z;
+
+  public Vector(double x, double y, double z) {
+    this.x = x;
+    this.y = y;
+    this.z = z;
+  }
+
+  public void copy(Vector vector) {
+    this.x = vector.x;
+    this.y = vector.y;
+    this.z = vector.z;
+  }
+
+  public Vector normalize() {
+    double m = this.magnitude();
+    return new Vector(this.x / m, this.y / m, this.z / m);
+  }
+
+  public double magnitude() {
+    return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z));
+  }
+
+  public Vector cross(Vector w) {
+    return new Vector(-this.z * w.y + this.y * w.z, this.z * w.x - this.x * w.z,
+        -this.y * w.x + this.x * w.y);
+  }
+
+  public double dot(Vector w) {
+    return this.x * w.x + this.y * w.y + this.z * w.z;
+  }
+
+  public static Vector add(Vector v, Vector w) {
+    return new Vector(w.x + v.x, w.y + v.y, w.z + v.z);
+  }
+
+  public static Vector subtract(Vector v, Vector w) {
+    return new Vector(v.x - w.x, v.y - w.y, v.z - w.z);
+  }
+
+  public Vector multiplyVector(Vector v, Vector w) {
+    return new Vector(v.x * w.x, v.y * w.y, v.z * w.z);
+  }
+
+  public static Vector multiplyScalar(Vector v, double w) {
+    return new Vector(v.x * w, v.y * w, v.z * w);
+  }
+
+  @Override
+  public String toString() {
+    return "Vector [" + this.x + "," + this.y + "," + this.z + "]";
+  }
+
+  // getters are added for a real Java style benchmark
+  public double getX() {
+    return x;
+  }
+
+  public double getY() {
+    return y;
+  }
+
+  public double getZ() {
+    return z;
+  }
+
+  public void setY(double y) {
+    this.y = y;
+  }
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/js/RayTraceJsBenchmark.java b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/js/RayTraceJsBenchmark.java
new file mode 100644
index 0000000..e0a3723
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/js/RayTraceJsBenchmark.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.benchmark.benchmarks.octane.client.raytrace.js;
+
+import com.google.gwt.benchmark.benchmarks.octane.client.OctaneJS;
+import com.google.gwt.benchmark.framework.client.AbstractBenchmarkEntryPoint;
+import com.google.gwt.benchmark.framework.client.Injector;
+import com.google.gwt.benchmark.framework.client.Injector.GlobalMapping;
+import com.google.gwt.benchmark.framework.shared.AbstractBenchmark;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.TextResource;
+
+public class RayTraceJsBenchmark extends AbstractBenchmark {
+
+  public static class EntryPoint extends AbstractBenchmarkEntryPoint {
+
+    @Override
+    protected AbstractBenchmark getBenchmark() {
+      return new RayTraceJsBenchmark();
+    }
+  }
+
+  interface Resource extends ClientBundle {
+    @Source("raytrace.js")
+    TextResource rayTraceJavaScript();
+  }
+
+  public RayTraceJsBenchmark() {
+    super("Octane_raytrace_js");
+  }
+
+  static {
+    Resource r = GWT.create(Resource.class);
+    new Injector().injectJavaScript(OctaneJS.PREAMBLE + r.rayTraceJavaScript().getText(),
+        new GlobalMapping("__octane__raytrace_js", "renderScene"));
+  }
+
+  @Override
+  public native Object run() /*-{
+    return $wnd.__octane__raytrace_js();
+  }-*/;
+}
diff --git a/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/js/raytrace.js b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/js/raytrace.js
new file mode 100644
index 0000000..70f7b36
--- /dev/null
+++ b/benchmarks/src/main/java/com/google/gwt/benchmark/benchmarks/octane/client/raytrace/js/raytrace.js
@@ -0,0 +1,904 @@
+// The ray tracer code in this file is written by Adam Burmister. It
+// is available in its original form from:
+//
+//   http://labs.flog.nz.co/raytracer/
+//
+// It has been modified slightly by Google to work as a standalone
+// benchmark, but the all the computational code remains
+// untouched. This file also contains a copy of parts of the Prototype
+// JavaScript framework which is used by the ray tracer.
+
+ var RayTrace = new BenchmarkSuite('RayTrace', [739989], [
+   new Benchmark('RayTrace', true, false, 600, renderScene)
+ ]);
+
+
+// Variable used to hold a number that can be used to verify that
+// the scene was ray traced correctly.
+var checkNumber;
+
+
+// ------------------------------------------------------------------------
+// ------------------------------------------------------------------------
+
+// The following is a copy of parts of the Prototype JavaScript library:
+
+// Prototype JavaScript framework, version 1.5.0
+// (c) 2005-2007 Sam Stephenson
+//
+// Prototype is freely distributable under the terms of an MIT-style license.
+// For details, see the Prototype web site: http://prototype.conio.net/
+
+
+var Class = {
+  create: function() {
+    return function() {
+      this.initialize.apply(this, arguments);
+    }
+  }
+};
+
+
+Object.extend = function(destination, source) {
+  for (var property in source) {
+    destination[property] = source[property];
+  }
+  return destination;
+};
+
+
+// ------------------------------------------------------------------------
+// ------------------------------------------------------------------------
+
+// The rest of this file is the actual ray tracer written by Adam
+// Burmister. It's a concatenation of the following files:
+//
+//   flog/color.js
+//   flog/light.js
+//   flog/vector.js
+//   flog/ray.js
+//   flog/scene.js
+//   flog/material/basematerial.js
+//   flog/material/solid.js
+//   flog/material/chessboard.js
+//   flog/shape/baseshape.js
+//   flog/shape/sphere.js
+//   flog/shape/plane.js
+//   flog/intersectioninfo.js
+//   flog/camera.js
+//   flog/background.js
+//   flog/engine.js
+
+
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Color = Class.create();
+
+Flog.RayTracer.Color.prototype = {
+    red : 0.0,
+    green : 0.0,
+    blue : 0.0,
+
+    initialize : function(r, g, b) {
+        if(!r) r = 0.0;
+        if(!g) g = 0.0;
+        if(!b) b = 0.0;
+
+        this.red = r;
+        this.green = g;
+        this.blue = b;
+    },
+
+    add : function(c1, c2){
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red + c2.red;
+        result.green = c1.green + c2.green;
+        result.blue = c1.blue + c2.blue;
+
+        return result;
+    },
+
+    addScalar: function(c1, s){
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red + s;
+        result.green = c1.green + s;
+        result.blue = c1.blue + s;
+
+        result.limit();
+
+        return result;
+    },
+
+    subtract: function(c1, c2){
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red - c2.red;
+        result.green = c1.green - c2.green;
+        result.blue = c1.blue - c2.blue;
+
+        return result;
+    },
+
+    multiply : function(c1, c2) {
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red * c2.red;
+        result.green = c1.green * c2.green;
+        result.blue = c1.blue * c2.blue;
+
+        return result;
+    },
+
+    multiplyScalar : function(c1, f) {
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red * f;
+        result.green = c1.green * f;
+        result.blue = c1.blue * f;
+
+        return result;
+    },
+
+    divideFactor : function(c1, f) {
+        var result = new Flog.RayTracer.Color(0,0,0);
+
+        result.red = c1.red / f;
+        result.green = c1.green / f;
+        result.blue = c1.blue / f;
+
+        return result;
+    },
+
+    limit: function(){
+        this.red = (this.red > 0.0) ? ( (this.red > 1.0) ? 1.0 : this.red ) : 0.0;
+        this.green = (this.green > 0.0) ? ( (this.green > 1.0) ? 1.0 : this.green ) : 0.0;
+        this.blue = (this.blue > 0.0) ? ( (this.blue > 1.0) ? 1.0 : this.blue ) : 0.0;
+    },
+
+    distance : function(color) {
+        var d = Math.abs(this.red - color.red) + Math.abs(this.green - color.green) + Math.abs(this.blue - color.blue);
+        return d;
+    },
+
+    blend: function(c1, c2, w){
+        var result = new Flog.RayTracer.Color(0,0,0);
+        result = Flog.RayTracer.Color.prototype.add(
+                    Flog.RayTracer.Color.prototype.multiplyScalar(c1, 1 - w),
+                    Flog.RayTracer.Color.prototype.multiplyScalar(c2, w)
+                  );
+        return result;
+    },
+
+    brightness : function() {
+        var r = Math.floor(this.red*255);
+        var g = Math.floor(this.green*255);
+        var b = Math.floor(this.blue*255);
+        return (r * 77 + g * 150 + b * 29) >> 8;
+    },
+
+    toString : function () {
+        var r = Math.floor(this.red*255);
+        var g = Math.floor(this.green*255);
+        var b = Math.floor(this.blue*255);
+
+        return "rgb("+ r +","+ g +","+ b +")";
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Light = Class.create();
+
+Flog.RayTracer.Light.prototype = {
+    position: null,
+    color: null,
+    intensity: 10.0,
+
+    initialize : function(pos, color, intensity) {
+        this.position = pos;
+        this.color = color;
+        this.intensity = (intensity ? intensity : 10.0);
+    },
+
+    toString : function () {
+        return 'Light [' + this.position.x + ',' + this.position.y + ',' + this.position.z + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Vector = Class.create();
+
+Flog.RayTracer.Vector.prototype = {
+    x : 0.0,
+    y : 0.0,
+    z : 0.0,
+
+    initialize : function(x, y, z) {
+        this.x = (x ? x : 0);
+        this.y = (y ? y : 0);
+        this.z = (z ? z : 0);
+    },
+
+    copy: function(vector){
+        this.x = vector.x;
+        this.y = vector.y;
+        this.z = vector.z;
+    },
+
+    normalize : function() {
+        var m = this.magnitude();
+        return new Flog.RayTracer.Vector(this.x / m, this.y / m, this.z / m);
+    },
+
+    magnitude : function() {
+        return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z));
+    },
+
+    cross : function(w) {
+        return new Flog.RayTracer.Vector(
+                                            -this.z * w.y + this.y * w.z,
+                                           this.z * w.x - this.x * w.z,
+                                          -this.y * w.x + this.x * w.y);
+    },
+
+    dot : function(w) {
+        return this.x * w.x + this.y * w.y + this.z * w.z;
+    },
+
+    add : function(v, w) {
+        return new Flog.RayTracer.Vector(w.x + v.x, w.y + v.y, w.z + v.z);
+    },
+
+    subtract : function(v, w) {
+        if(!w || !v) throw 'Vectors must be defined [' + v + ',' + w + ']';
+        return new Flog.RayTracer.Vector(v.x - w.x, v.y - w.y, v.z - w.z);
+    },
+
+    multiplyVector : function(v, w) {
+        return new Flog.RayTracer.Vector(v.x * w.x, v.y * w.y, v.z * w.z);
+    },
+
+    multiplyScalar : function(v, w) {
+        return new Flog.RayTracer.Vector(v.x * w, v.y * w, v.z * w);
+    },
+
+    toString : function () {
+        return 'Vector [' + this.x + ',' + this.y + ',' + this.z + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Ray = Class.create();
+
+Flog.RayTracer.Ray.prototype = {
+    position : null,
+    direction : null,
+    initialize : function(pos, dir) {
+        this.position = pos;
+        this.direction = dir;
+    },
+
+    toString : function () {
+        return 'Ray [' + this.position + ',' + this.direction + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Scene = Class.create();
+
+Flog.RayTracer.Scene.prototype = {
+    camera : null,
+    shapes : [],
+    lights : [],
+    background : null,
+
+    initialize : function() {
+        this.camera = new Flog.RayTracer.Camera(
+            new Flog.RayTracer.Vector(0,0,-5),
+            new Flog.RayTracer.Vector(0,0,1),
+            new Flog.RayTracer.Vector(0,1,0)
+        );
+        this.shapes = new Array();
+        this.lights = new Array();
+        this.background = new Flog.RayTracer.Background(new Flog.RayTracer.Color(0,0,0.5), 0.2);
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+if(typeof(Flog.RayTracer.Material) == 'undefined') Flog.RayTracer.Material = {};
+
+Flog.RayTracer.Material.BaseMaterial = Class.create();
+
+Flog.RayTracer.Material.BaseMaterial.prototype = {
+
+    gloss: 2.0,             // [0...infinity] 0 = matt
+    transparency: 0.0,      // 0=opaque
+    reflection: 0.0,        // [0...infinity] 0 = no reflection
+    refraction: 0.50,
+    hasTexture: false,
+
+    initialize : function() {
+
+    },
+
+    getColor: function(u, v){
+
+    },
+
+    wrapUp: function(t){
+        t = t % 2.0;
+        if(t < -1) t += 2.0;
+        if(t >= 1) t -= 2.0;
+        return t;
+    },
+
+    toString : function () {
+        return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Material.Solid = Class.create();
+
+Flog.RayTracer.Material.Solid.prototype = Object.extend(
+    new Flog.RayTracer.Material.BaseMaterial(), {
+        initialize : function(color, reflection, refraction, transparency, gloss) {
+            this.color = color;
+            this.reflection = reflection;
+            this.transparency = transparency;
+            this.gloss = gloss;
+            this.hasTexture = false;
+        },
+
+        getColor: function(u, v){
+            return this.color;
+        },
+
+        toString : function () {
+            return 'SolidMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']';
+        }
+    }
+);
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Material.Chessboard = Class.create();
+
+Flog.RayTracer.Material.Chessboard.prototype = Object.extend(
+    new Flog.RayTracer.Material.BaseMaterial(), {
+        colorEven: null,
+        colorOdd: null,
+        density: 0.5,
+
+        initialize : function(colorEven, colorOdd, reflection, transparency, gloss, density) {
+            this.colorEven = colorEven;
+            this.colorOdd = colorOdd;
+            this.reflection = reflection;
+            this.transparency = transparency;
+            this.gloss = gloss;
+            this.density = density;
+            this.hasTexture = true;
+        },
+
+        getColor: function(u, v){
+            var t = this.wrapUp(u * this.density) * this.wrapUp(v * this.density);
+
+            if(t < 0.0)
+                return this.colorEven;
+            else
+                return this.colorOdd;
+        },
+
+        toString : function () {
+            return 'ChessMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']';
+        }
+    }
+);
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {};
+
+Flog.RayTracer.Shape.Sphere = Class.create();
+
+Flog.RayTracer.Shape.Sphere.prototype = {
+    initialize : function(pos, radius, material) {
+        this.radius = radius;
+        this.position = pos;
+        this.material = material;
+    },
+
+    intersect: function(ray){
+        var info = new Flog.RayTracer.IntersectionInfo();
+        info.shape = this;
+
+        var dst = Flog.RayTracer.Vector.prototype.subtract(ray.position, this.position);
+
+        var B = dst.dot(ray.direction);
+        var C = dst.dot(dst) - (this.radius * this.radius);
+        var D = (B * B) - C;
+
+        if(D > 0){ // intersection!
+            info.isHit = true;
+            info.distance = (-B) - Math.sqrt(D);
+            info.position = Flog.RayTracer.Vector.prototype.add(
+                                                ray.position,
+                                                Flog.RayTracer.Vector.prototype.multiplyScalar(
+                                                    ray.direction,
+                                                    info.distance
+                                                )
+                                            );
+            info.normal = Flog.RayTracer.Vector.prototype.subtract(
+                                            info.position,
+                                            this.position
+                                        ).normalize();
+
+            info.color = this.material.getColor(0,0);
+        } else {
+            info.isHit = false;
+        }
+        return info;
+    },
+
+    toString : function () {
+        return 'Sphere [position=' + this.position + ', radius=' + this.radius + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {};
+
+Flog.RayTracer.Shape.Plane = Class.create();
+
+Flog.RayTracer.Shape.Plane.prototype = {
+    d: 0.0,
+
+    initialize : function(pos, d, material) {
+        this.position = pos;
+        this.d = d;
+        this.material = material;
+    },
+
+    intersect: function(ray){
+        var info = new Flog.RayTracer.IntersectionInfo();
+
+        var Vd = this.position.dot(ray.direction);
+        if(Vd == 0) return info; // no intersection
+
+        var t = -(this.position.dot(ray.position) + this.d) / Vd;
+        if(t <= 0) return info;
+
+        info.shape = this;
+        info.isHit = true;
+        info.position = Flog.RayTracer.Vector.prototype.add(
+                                            ray.position,
+                                            Flog.RayTracer.Vector.prototype.multiplyScalar(
+                                                ray.direction,
+                                                t
+                                            )
+                                        );
+        info.normal = this.position;
+        info.distance = t;
+
+        if(this.material.hasTexture){
+            var vU = new Flog.RayTracer.Vector(this.position.y, this.position.z, -this.position.x);
+            var vV = vU.cross(this.position);
+            var u = info.position.dot(vU);
+            var v = info.position.dot(vV);
+            info.color = this.material.getColor(u,v);
+        } else {
+            info.color = this.material.getColor(0,0);
+        }
+
+        return info;
+    },
+
+    toString : function () {
+        return 'Plane [' + this.position + ', d=' + this.d + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.IntersectionInfo = Class.create();
+
+Flog.RayTracer.IntersectionInfo.prototype = {
+    isHit: false,
+    hitCount: 0,
+    shape: null,
+    position: null,
+    normal: null,
+    color: null,
+    distance: null,
+
+    initialize : function() {
+        this.color = new Flog.RayTracer.Color(0,0,0);
+    },
+
+    toString : function () {
+        return 'Intersection [' + this.position + ']';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Camera = Class.create();
+
+Flog.RayTracer.Camera.prototype = {
+    position: null,
+    lookAt: null,
+    equator: null,
+    up: null,
+    screen: null,
+
+    initialize : function(pos, lookAt, up) {
+        this.position = pos;
+        this.lookAt = lookAt;
+        this.up = up;
+        this.equator = lookAt.normalize().cross(this.up);
+        this.screen = Flog.RayTracer.Vector.prototype.add(this.position, this.lookAt);
+    },
+
+    getRay: function(vx, vy){
+        var pos = Flog.RayTracer.Vector.prototype.subtract(
+            this.screen,
+            Flog.RayTracer.Vector.prototype.subtract(
+                Flog.RayTracer.Vector.prototype.multiplyScalar(this.equator, vx),
+                Flog.RayTracer.Vector.prototype.multiplyScalar(this.up, vy)
+            )
+        );
+        pos.y = pos.y * -1;
+        var dir = Flog.RayTracer.Vector.prototype.subtract(
+            pos,
+            this.position
+        );
+
+        var ray = new Flog.RayTracer.Ray(pos, dir.normalize());
+
+        return ray;
+    },
+
+    toString : function () {
+        return 'Ray []';
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Background = Class.create();
+
+Flog.RayTracer.Background.prototype = {
+    color : null,
+    ambience : 0.0,
+
+    initialize : function(color, ambience) {
+        this.color = color;
+        this.ambience = ambience;
+    }
+}
+/* Fake a Flog.* namespace */
+if(typeof(Flog) == 'undefined') var Flog = {};
+if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {};
+
+Flog.RayTracer.Engine = Class.create();
+
+Flog.RayTracer.Engine.prototype = {
+    canvas: null, /* 2d context we can render to */
+
+    initialize: function(options){
+        this.options = Object.extend({
+                canvasHeight: 100,
+                canvasWidth: 100,
+                pixelWidth: 2,
+                pixelHeight: 2,
+                renderDiffuse: false,
+                renderShadows: false,
+                renderHighlights: false,
+                renderReflections: false,
+                rayDepth: 2
+            }, options || {});
+
+        this.options.canvasHeight /= this.options.pixelHeight;
+        this.options.canvasWidth /= this.options.pixelWidth;
+
+        /* TODO: dynamically include other scripts */
+    },
+
+    setPixel: function(x, y, color){
+        var pxW, pxH;
+        pxW = this.options.pixelWidth;
+        pxH = this.options.pixelHeight;
+
+        if (this.canvas) {
+          this.canvas.fillStyle = color.toString();
+          this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH);
+        } else {
+          if (x ===  y) {
+            checkNumber += color.brightness();
+          }
+          // print(x * pxW, y * pxH, pxW, pxH);
+        }
+    },
+
+    renderScene: function(scene, canvas){
+        checkNumber = 0;
+        /* Get canvas */
+        if (canvas) {
+          this.canvas = canvas.getContext("2d");
+        } else {
+          this.canvas = null;
+        }
+
+        var canvasHeight = this.options.canvasHeight;
+        var canvasWidth = this.options.canvasWidth;
+
+        for(var y=0; y < canvasHeight; y++){
+            for(var x=0; x < canvasWidth; x++){
+                var yp = y * 1.0 / canvasHeight * 2 - 1;
+          		var xp = x * 1.0 / canvasWidth * 2 - 1;
+
+          		var ray = scene.camera.getRay(xp, yp);
+
+          		var color = this.getPixelColor(ray, scene);
+
+            	this.setPixel(x, y, color);
+            }
+        }
+        if (checkNumber !== 2321) {
+          throw new Error("Scene rendered incorrectly");
+        }
+    },
+
+    getPixelColor: function(ray, scene){
+        var info = this.testIntersection(ray, scene, null);
+        if(info.isHit){
+            var color = this.rayTrace(info, ray, scene, 0);
+            return color;
+        }
+        return scene.background.color;
+    },
+
+    testIntersection: function(ray, scene, exclude){
+        var hits = 0;
+        var best = new Flog.RayTracer.IntersectionInfo();
+        best.distance = 2000;
+
+        for(var i=0; i<scene.shapes.length; i++){
+            var shape = scene.shapes[i];
+
+            if(shape != exclude){
+                var info = shape.intersect(ray);
+                if(info.isHit && info.distance >= 0 && info.distance < best.distance){
+                    best = info;
+                    hits++;
+                }
+            }
+        }
+        best.hitCount = hits;
+        return best;
+    },
+
+    getReflectionRay: function(P,N,V){
+        var c1 = -N.dot(V);
+        var R1 = Flog.RayTracer.Vector.prototype.add(
+            Flog.RayTracer.Vector.prototype.multiplyScalar(N, 2*c1),
+            V
+        );
+        return new Flog.RayTracer.Ray(P, R1);
+    },
+
+    rayTrace: function(info, ray, scene, depth){
+        // Calc ambient
+        var color = Flog.RayTracer.Color.prototype.multiplyScalar(info.color, scene.background.ambience);
+        var oldColor = color;
+        var shininess = Math.pow(10, info.shape.material.gloss + 1);
+
+        for(var i=0; i<scene.lights.length; i++){
+            var light = scene.lights[i];
+
+            // Calc diffuse lighting
+            var v = Flog.RayTracer.Vector.prototype.subtract(
+                                light.position,
+                                info.position
+                            ).normalize();
+
+            if(this.options.renderDiffuse){
+                var L = v.dot(info.normal);
+                if(L > 0.0){
+                    color = Flog.RayTracer.Color.prototype.add(
+                                        color,
+                                        Flog.RayTracer.Color.prototype.multiply(
+                                            info.color,
+                                            Flog.RayTracer.Color.prototype.multiplyScalar(
+                                                light.color,
+                                                L
+                                            )
+                                        )
+                                    );
+                }
+            }
+
+            // The greater the depth the more accurate the colours, but
+            // this is exponentially (!) expensive
+            if(depth <= this.options.rayDepth){
+          // calculate reflection ray
+          if(this.options.renderReflections && info.shape.material.reflection > 0)
+          {
+              var reflectionRay = this.getReflectionRay(info.position, info.normal, ray.direction);
+              var refl = this.testIntersection(reflectionRay, scene, info.shape);
+
+              if (refl.isHit && refl.distance > 0){
+                  refl.color = this.rayTrace(refl, reflectionRay, scene, depth + 1);
+              } else {
+                  refl.color = scene.background.color;
+                        }
+
+                  color = Flog.RayTracer.Color.prototype.blend(
+                    color,
+                    refl.color,
+                    info.shape.material.reflection
+                  );
+          }
+
+                // Refraction
+                /* TODO */
+            }
+
+            /* Render shadows and highlights */
+
+            var shadowInfo = new Flog.RayTracer.IntersectionInfo();
+
+            if(this.options.renderShadows){
+                var shadowRay = new Flog.RayTracer.Ray(info.position, v);
+
+                shadowInfo = this.testIntersection(shadowRay, scene, info.shape);
+                if(shadowInfo.isHit && shadowInfo.shape != info.shape /*&& shadowInfo.shape.type != 'PLANE'*/){
+                    var vA = Flog.RayTracer.Color.prototype.multiplyScalar(color, 0.5);
+                    var dB = (0.5 * Math.pow(shadowInfo.shape.material.transparency, 0.5));
+                    color = Flog.RayTracer.Color.prototype.addScalar(vA,dB);
+                }
+            }
+
+      // Phong specular highlights
+      if(this.options.renderHighlights && !shadowInfo.isHit && info.shape.material.gloss > 0){
+        var Lv = Flog.RayTracer.Vector.prototype.subtract(
+                            info.shape.position,
+                            light.position
+                        ).normalize();
+
+        var E = Flog.RayTracer.Vector.prototype.subtract(
+                            scene.camera.position,
+                            info.shape.position
+                        ).normalize();
+
+        var H = Flog.RayTracer.Vector.prototype.subtract(
+                            E,
+                            Lv
+                        ).normalize();
+
+        var glossWeight = Math.pow(Math.max(info.normal.dot(H), 0), shininess);
+        color = Flog.RayTracer.Color.prototype.add(
+                            Flog.RayTracer.Color.prototype.multiplyScalar(light.color, glossWeight),
+                            color
+                        );
+      }
+        }
+        color.limit();
+        return color;
+    }
+};
+
+
+function renderScene(){
+    var scene = new Flog.RayTracer.Scene();
+
+    scene.camera = new Flog.RayTracer.Camera(
+                        new Flog.RayTracer.Vector(0, 0, -15),
+                        new Flog.RayTracer.Vector(-0.2, 0, 5),
+                        new Flog.RayTracer.Vector(0, 1, 0)
+                    );
+
+    scene.background = new Flog.RayTracer.Background(
+                                new Flog.RayTracer.Color(0.5, 0.5, 0.5),
+                                0.4
+                            );
+
+    var sphere = new Flog.RayTracer.Shape.Sphere(
+        new Flog.RayTracer.Vector(-1.5, 1.5, 2),
+        1.5,
+        new Flog.RayTracer.Material.Solid(
+            new Flog.RayTracer.Color(0,0.5,0.5),
+            0.3,
+            0.0,
+            0.0,
+            2.0
+        )
+    );
+
+    var sphere1 = new Flog.RayTracer.Shape.Sphere(
+        new Flog.RayTracer.Vector(1, 0.25, 1),
+        0.5,
+        new Flog.RayTracer.Material.Solid(
+            new Flog.RayTracer.Color(0.9,0.9,0.9),
+            0.1,
+            0.0,
+            0.0,
+            1.5
+        )
+    );
+
+    var plane = new Flog.RayTracer.Shape.Plane(
+                                new Flog.RayTracer.Vector(0.1, 0.9, -0.5).normalize(),
+                                1.2,
+                                new Flog.RayTracer.Material.Chessboard(
+                                    new Flog.RayTracer.Color(1,1,1),
+                                    new Flog.RayTracer.Color(0,0,0),
+                                    0.2,
+                                    0.0,
+                                    1.0,
+                                    0.7
+                                )
+                            );
+
+    scene.shapes.push(plane);
+    scene.shapes.push(sphere);
+    scene.shapes.push(sphere1);
+
+    var light = new Flog.RayTracer.Light(
+        new Flog.RayTracer.Vector(5, 10, -1),
+        new Flog.RayTracer.Color(0.8, 0.8, 0.8)
+    );
+
+    var light1 = new Flog.RayTracer.Light(
+        new Flog.RayTracer.Vector(-3, 5, -15),
+        new Flog.RayTracer.Color(0.8, 0.8, 0.8),
+        100
+    );
+
+    scene.lights.push(light);
+    scene.lights.push(light1);
+
+    var imageWidth = 100; // $F('imageWidth');
+    var imageHeight = 100; // $F('imageHeight');
+    var pixelSize = "5,5".split(','); //  $F('pixelSize').split(',');
+    var renderDiffuse = true; // $F('renderDiffuse');
+    var renderShadows = true; // $F('renderShadows');
+    var renderHighlights = true; // $F('renderHighlights');
+    var renderReflections = true; // $F('renderReflections');
+    var rayDepth = 2;//$F('rayDepth');
+
+    var raytracer = new Flog.RayTracer.Engine(
+        {
+            canvasWidth: imageWidth,
+            canvasHeight: imageHeight,
+            pixelWidth: pixelSize[0],
+            pixelHeight: pixelSize[1],
+            "renderDiffuse": renderDiffuse,
+            "renderHighlights": renderHighlights,
+            "renderShadows": renderShadows,
+            "renderReflections": renderReflections,
+            "rayDepth": rayDepth
+        }
+    );
+
+    raytracer.renderScene(scene, null, 0);
+}