Move v8 into third_party.

BUG=
R=robertphillips@google.com

Author: jcgregorio@google.com

Review URL: https://codereview.chromium.org/116693004

git-svn-id: http://skia.googlecode.com/svn/trunk@12954 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/DEPS b/DEPS
index dac55a3..4d55fd4 100644
--- a/DEPS
+++ b/DEPS
@@ -21,6 +21,7 @@
   "third_party/externals/jsoncpp-chromium" : "https://chromium.googlesource.com/chromium/src/third_party/jsoncpp.git@41239939c0c60481f34887d52c038facf05f5533",
   "third_party/externals/libwebp" : "https://chromium.googlesource.com/webm/libwebp.git@3fe91635df8734b23f3c1b9d1f0c4fa8cfaf4e39",
   "third_party/externals/poppler" : "https://skia.googlesource.com/third_party/poppler.git@poppler-0.22.5",
+  # "third_party/externals/v8" : "git://github.com/v8/v8.git@d15b0f0f2099dbd72867f3df70e9aaf5b8afbd2c",
 }
 
 deps_os = {
diff --git a/experimental/SkV8Example/Global.cpp b/experimental/SkV8Example/Global.cpp
index 998f92b..e8ad318 100644
--- a/experimental/SkV8Example/Global.cpp
+++ b/experimental/SkV8Example/Global.cpp
@@ -127,7 +127,7 @@
     evt->setFast32(id);
     evt->postDelay(delay);
 
-    args.GetReturnValue().Set(Integer::New(id));
+    args.GetReturnValue().Set(Integer::New(gGlobal->fIsolate, id));
 }
 
 // Callback function for SkEvents used to implement timeouts.
@@ -180,11 +180,11 @@
   Handle<ObjectTemplate> global = ObjectTemplate::New();
 
   global->Set(v8::String::NewFromUtf8(fIsolate, "print"),
-              v8::FunctionTemplate::New(Global::Print));
+              v8::FunctionTemplate::New(fIsolate, Global::Print));
   global->Set(v8::String::NewFromUtf8(fIsolate, "setTimeout"),
-              v8::FunctionTemplate::New(Global::SetTimeout));
+              v8::FunctionTemplate::New(fIsolate, Global::SetTimeout));
   global->Set(v8::String::NewFromUtf8(fIsolate, "inval"),
-              v8::FunctionTemplate::New(Global::Inval));
+              v8::FunctionTemplate::New(fIsolate, Global::Inval));
 
 
   return Context::New(fIsolate, NULL, global);
diff --git a/experimental/SkV8Example/JsContext.cpp b/experimental/SkV8Example/JsContext.cpp
index cb25dae..5778172 100644
--- a/experimental/SkV8Example/JsContext.cpp
+++ b/experimental/SkV8Example/JsContext.cpp
@@ -208,7 +208,8 @@
     JsContext* jsContext = Unwrap(info.This());
     SkISize size = jsContext->fCanvas->getDeviceSize();
 
-    info.GetReturnValue().Set(Int32::New(size.fWidth));
+    info.GetReturnValue().Set(
+            Int32::New(jsContext->fGlobal->getIsolate(), size.fWidth));
 }
 
 void JsContext::GetHeight(Local<String> name,
@@ -216,7 +217,8 @@
     JsContext* jsContext = Unwrap(info.This());
     SkISize size = jsContext->fCanvas->getDeviceSize();
 
-    info.GetReturnValue().Set(Int32::New(size.fHeight));
+    info.GetReturnValue().Set(
+            Int32::New(jsContext->fGlobal->getIsolate(), size.fHeight));
 }
 
 
@@ -226,7 +228,7 @@
     result->Set(String::NewFromUtf8( \
             fGlobal->getIsolate(), name, \
             String::kInternalizedString), \
-                FunctionTemplate::New(fn))
+                FunctionTemplate::New(fGlobal->getIsolate(), fn))
 
 Handle<ObjectTemplate> JsContext::makeContextTemplate() {
     EscapableHandleScope handleScope(fGlobal->getIsolate());
diff --git a/experimental/SkV8Example/Path.cpp b/experimental/SkV8Example/Path.cpp
index bce9667..2b53a0f 100644
--- a/experimental/SkV8Example/Path.cpp
+++ b/experimental/SkV8Example/Path.cpp
@@ -15,7 +15,8 @@
 void Path::ConstructPath(const v8::FunctionCallbackInfo<Value>& args) {
     HandleScope handleScope(gGlobal->getIsolate());
     Path* path = new Path();
-    args.This()->SetInternalField(0, External::New(path));
+    args.This()->SetInternalField(
+            0, External::New(gGlobal->getIsolate(), path));
 }
 
 #define ADD_METHOD(name, fn) \
@@ -23,7 +24,7 @@
             String::NewFromUtf8( \
                     global->getIsolate(), name, \
                     String::kInternalizedString), \
-            FunctionTemplate::New(fn))
+            FunctionTemplate::New(global->getIsolate(), fn))
 
 // Install the constructor in the global scope so Paths can be constructed
 // in JS.
@@ -39,7 +40,7 @@
     Context::Scope contextScope(context);
 
     Local<FunctionTemplate> constructor = FunctionTemplate::New(
-            Path::ConstructPath);
+            gGlobal->getIsolate(), Path::ConstructPath);
     constructor->InstanceTemplate()->SetInternalFieldCount(1);
 
     ADD_METHOD("close", ClosePath);
@@ -50,7 +51,8 @@
     ADD_METHOD("arc", Arc);
     ADD_METHOD("rect", Rect);
 
-    context->Global()->Set(String::New("Path"), constructor->GetFunction());
+    context->Global()->Set(String::NewFromUtf8(
+            gGlobal->getIsolate(), "Path"), constructor->GetFunction());
 }
 
 Path* Path::Unwrap(const v8::FunctionCallbackInfo<Value>& args) {
diff --git a/experimental/SkV8Example/README b/experimental/SkV8Example/README
new file mode 100644
index 0000000..f69509d
--- /dev/null
+++ b/experimental/SkV8Example/README
@@ -0,0 +1,16 @@
+Build Instructions
+==================
+
+V8 gyp is not quite standard and Chromium uses a Python script
+to work around that, for now we have some manual steps to do
+before you can compile and run this sample:
+
+1. Uncomment out the v8 dep in DEPS and re-run gclient sync.
+2. Run 'make dependencies' in third_pary/externals/v8.
+3. Run 'make native' in third_pary/externals/v8.
+4. Uncomment SkV8Example in gyp/everything.gyp.
+5. Run 'make -C out/ SkV8Example BUILDTYPE=Debugmake'
+6. Run the sample as:
+     ./out/Debug/SkV8Example --infile experimental/SkV8Example/speed.js
+
+
diff --git a/gyp/v8.gyp b/gyp/v8.gyp
index e39ccbc..baa0b3a 100644
--- a/gyp/v8.gyp
+++ b/gyp/v8.gyp
@@ -7,50 +7,44 @@
       'mac_bundle' : 1,
       'include_dirs' : [
         '../tools/flags',
-        '../../../v8/include',
+        '../third_party/externals/v8/include',
         ],
-      'includes': [],
        'sources': [
-         '../experimental/SkV8Example/SkV8Example.h',
          '../experimental/SkV8Example/SkV8Example.cpp',
-         '../experimental/SkV8Example/Global.h',
+         '../experimental/SkV8Example/SkV8Example.h',
          '../experimental/SkV8Example/Global.cpp',
-         '../experimental/SkV8Example/Path.h',
+         '../experimental/SkV8Example/Global.h',
          '../experimental/SkV8Example/Path.cpp',
-         '../experimental/SkV8Example/JsContext.h',
+         '../experimental/SkV8Example/Path.h',
          '../experimental/SkV8Example/JsContext.cpp',
+         '../experimental/SkV8Example/JsContext.h',
        ],
        'dependencies': [
+         'flags.gyp:flags',
          'skia_lib.gyp:skia_lib',
          'views.gyp:views',
          'xml.gyp:xml',
-         'flags.gyp:flags',
        ],
+       'link_settings': {
+         'libraries': [
 
-        'link_settings': {
-          'libraries': [
+#        'd:/src/v8/build/Debug/lib/v8_base.ia32.lib',
+#        'd:/src/v8/build/Debug/lib/v8_snapshot.lib',
+#        'd:/src/v8/build/Debug/lib/icuuc.lib',
+#        'd:/src/v8/build/Debug/lib/icui18n.lib',
+#        'Ws2_32.lib',
+#        'Winmm.lib',
 
-#            'd:/src/v8/build/Debug/lib/v8_base.ia32.lib',
-#            'd:/src/v8/build/Debug/lib/v8_snapshot.lib',
-
-#            'd:/src/v8/build/Debug/lib/icuuc.lib',
-#            'd:/src/v8/build/Debug/lib/icui18n.lib',
-
-#            'Ws2_32.lib',
-#            'Winmm.lib',
-
-            '-lpthread',
-            '-lrt',
-            '../../../v8/out/native/obj.target/tools/gyp/libv8_base.x64.a',
-          '../../../v8/out/native/obj.target/tools/gyp/libv8_snapshot.a',
-
-          '../../../v8/out/native/obj.target/third_party/icu/libicudata.a',
-          '../../../v8/out/native/obj.target/third_party/icu/libicui18n.a',
-          '../../../v8/out/native/obj.target/third_party/icu/libicuuc.a',
-
-          '../../../v8/out/native/obj.target/icudata/third_party/icu/linux/icudt46l_dat.o',
-            ],
-        },
+           '-lpthread',
+           '-lrt',
+           '../third_party/externals/v8/out/native/obj.target/tools/gyp/libv8_base.x64.a',
+           '../third_party/externals/v8/out/native/obj.target/tools/gyp/libv8_snapshot.a',
+           '../third_party/externals/v8/out/native/obj.target/third_party/icu/libicudata.a',
+           '../third_party/externals/v8/out/native/obj.target/third_party/icu/libicui18n.a',
+           '../third_party/externals/v8/out/native/obj.target/third_party/icu/libicuuc.a',
+           '../third_party/externals/v8/out/native/obj.target/icudata/third_party/icu/linux/icudt46l_dat.o',
+           ],
+       },
        'conditions' : [
          [ 'skia_gpu == 1', {
            'include_dirs' : [