Upgrade to V8 3.4

Merge 3.4.14.35

Simple merge required updates to makefiles only.

Bug: 568872
Change-Id: I403a38452c547e06fcfa951c12eca12a1bc40978
diff --git a/build/README.txt b/build/README.txt
index f6b9255..c74b520 100644
--- a/build/README.txt
+++ b/build/README.txt
@@ -9,23 +9,40 @@
 
 $ svn co http://gyp.googlecode.com/svn/trunk build/gyp
 
-To generate Makefiles and build 32-bit version on Linux:
---------------------------------------------------------
+Note for the command lines below that Debug is the default configuration,
+so specifying that on the command lines is not required.
 
-$ GYP_DEFINES=target_arch=ia32 build/gyp_v8
-$ make
 
-To generate Makefiles and build 64-bit version on Linux:
---------------------------------------------------------
+To generate Makefiles on Linux:
+-------------------------------
 
-$ GYP_DEFINES=target_arch=x64 build/gyp_v8
-$ make
+$ build/gyp_v8
 
-To generate Makefiles and build for the arm simulator on Linux:
----------------------------------------------------------------
+This will build makefiles for ia32, x64 and the ARM simulator with names
+Makefile-ia32, Makefile-x64 and Makefile-armu respectively.
 
-$ build/gyp_v8 -I build/arm.gypi
-$ make
+To build and run for ia32 in debug and release version do:
+
+$ make -f Makefile-ia32
+$ out/Debug/shell
+$ make -f Makefile-ia32 BUILDTYPE=Release
+$ out/Release/shell
+
+Change the makefile to build and run for the other architectures.
+
+
+To generate Xcode project files on Mac OS:
+------------------------------------------
+
+$ build/gyp_v8
+
+This will make an Xcode project for the ia32 architecture. To build and run do:
+
+$ xcodebuild -project build/all.xcodeproj
+$ samples/build/Debug/shell
+$ xcodebuild -project build/all.xcodeproj -configuration Release
+$ samples/build/Release/shell
+
 
 To generate Visual Studio solution and project files on Windows:
 ----------------------------------------------------------------
@@ -42,8 +59,8 @@
 
 > svn co http://src.chromium.org/svn/trunk/tools/third_party/python_26@70627 third_party/python_26
 
-Now generate Visual Studio solution and project files:
+Now generate Visual Studio solution and project files for the ia32 architecture:
 
-> third_party\python_26\python build/gyp_v8 -D target_arch=ia32
+> third_party\python_26\python build/gyp_v8
 
 Now open build\All.sln in Visual Studio.
diff --git a/build/all.gyp b/build/all.gyp
index 544e2c2..38287e3 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -9,9 +9,15 @@
       'type': 'none',
       'dependencies': [
         '../samples/samples.gyp:*',
-        '../test/cctest/cctest.gyp:*',
-        '../src/d8.gyp:*',
-      ]
+        '../src/d8.gyp:d8',
+      ],
+      'conditions': [
+        [ 'component!="shared_library"', {
+          'dependencies': [
+            '../test/cctest/cctest.gyp:*',
+          ],
+        }]
+      ],
     }
   ]
 }
diff --git a/build/armu.gypi b/build/armu.gypi
index 72eb4d1..3f874c0 100644
--- a/build/armu.gypi
+++ b/build/armu.gypi
@@ -1,4 +1,4 @@
-# Copyright 2010 the V8 project authors. All rights reserved.
+# Copyright 2011 the V8 project authors. All rights reserved.
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
 # met:
@@ -27,6 +27,10 @@
 
 {
   'variables': {
+    'target_arch': 'ia32',
     'v8_target_arch': 'arm',
+    'armv7': 1,
+    'arm_neon': 0,
+    'arm_fpu': 'vfpv3',
   }
 }
diff --git a/build/common.gypi b/build/common.gypi
index 19b4dc2..7020495 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -139,6 +139,45 @@
           },
         },
       },
-    }]
+    }],  # OS=="win"
+    ['OS=="mac"', {
+      'target_defaults': {
+        'xcode_settings': {
+          'ALWAYS_SEARCH_USER_PATHS': 'NO',
+          'GCC_C_LANGUAGE_STANDARD': 'ansi',        # -ansi
+          'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
+          'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
+                                                    # (Equivalent to -fPIC)
+          'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
+          'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
+          'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
+          # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
+          'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
+          'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
+          'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
+          'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
+          'GCC_VERSION': '4.2',
+          'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
+          'MACOSX_DEPLOYMENT_TARGET': '10.4',       # -mmacosx-version-min=10.4
+          'PREBINDING': 'NO',                       # No -Wl,-prebind
+          'USE_HEADERMAP': 'NO',
+          'OTHER_CFLAGS': [
+            '-fno-strict-aliasing',
+          ],
+          'WARNING_CFLAGS': [
+            '-Wall',
+            '-Wendif-labels',
+            '-W',
+            '-Wno-unused-parameter',
+            '-Wnon-virtual-dtor',
+          ],
+        },
+        'target_conditions': [
+          ['_type!="static_library"', {
+            'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
+          }],
+        ],  # target_conditions
+      },  # target_defaults
+    }],  # OS=="mac"
   ],
 }
diff --git a/build/gyp_v8 b/build/gyp_v8
index 0c2221e..61b54c2 100755
--- a/build/gyp_v8
+++ b/build/gyp_v8
@@ -38,9 +38,13 @@
 script_dir = os.path.dirname(__file__)
 v8_root = os.path.normpath(os.path.join(script_dir, os.pardir))
 
+sys.path.insert(0, os.path.join(v8_root, 'tools'))
+import utils
+
 sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib'))
 import gyp
 
+
 def apply_gyp_environment(file_path=None):
   """
   Reads in a *.gyp_env file and applies the valid keys to os.environ.
@@ -68,6 +72,7 @@
       else:
         os.environ[var] = val
 
+
 def additional_include_files(args=[]):
   """
   Returns a list of additional (.gypi) files to include, without
@@ -97,6 +102,14 @@
 
   return result
 
+
+def run_gyp(args):
+  rc = gyp.main(args)
+  if rc != 0:
+    print 'Error running GYP'
+    sys.exit(rc)
+
+
 if __name__ == '__main__':
   args = sys.argv[1:]
 
@@ -141,5 +154,20 @@
   print 'Updating projects from gyp files...'
   sys.stdout.flush()
 
-  # Off we go...
-  sys.exit(gyp.main(args))
+  # Generate for the architectures supported on the given platform.
+  gyp_args = list(args)
+  gyp_args.append('-Dtarget_arch=ia32')
+  if utils.GuessOS() == 'linux':
+    gyp_args.append('-S-ia32')
+  run_gyp(gyp_args)
+
+  if utils.GuessOS() == 'linux':
+    gyp_args = list(args)
+    gyp_args.append('-Dtarget_arch=x64')
+    gyp_args.append('-S-x64')
+    run_gyp(gyp_args)
+
+    gyp_args = list(args)
+    gyp_args.append('-I' + v8_root + '/build/armu.gypi')
+    gyp_args.append('-S-armu')
+    run_gyp(gyp_args)
diff --git a/build/v8-features.gypi b/build/v8-features.gypi
new file mode 100644
index 0000000..4037452
--- /dev/null
+++ b/build/v8-features.gypi
@@ -0,0 +1,125 @@
+# Copyright 2011 the V8 project authors. All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+#       copyright notice, this list of conditions and the following
+#       disclaimer in the documentation and/or other materials provided
+#       with the distribution.
+#     * Neither the name of Google Inc. nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# TODO(sgjesse): This is currently copied from v8.gyp, should probably
+# be refactored.
+{
+  'variables': {
+    'use_system_v8%': 0,
+    'msvs_use_common_release': 0,
+    'gcc_version%': 'unknown',
+    'v8_compress_startup_data%': 'off',
+    'v8_target_arch%': '<(target_arch)',
+
+    # Setting 'v8_can_use_unaligned_accesses' to 'true' will allow the code
+    # generated by V8 to do unaligned memory access, and setting it to 'false'
+    # will ensure that the generated code will always do aligned memory
+    # accesses. The default value of 'default' will try to determine the correct
+    # setting. Note that for Intel architectures (ia32 and x64) unaligned memory
+    # access is allowed for all CPUs.
+    'v8_can_use_unaligned_accesses%': 'default',
+
+    # Setting 'v8_can_use_vfp_instructions' to 'true' will enable use of ARM VFP
+    # instructions in the V8 generated code. VFP instructions will be enabled
+    # both for the snapshot and for the ARM target. Leaving the default value
+    # of 'false' will avoid VFP instructions in the snapshot and use CPU feature
+    # probing when running on the target.
+    'v8_can_use_vfp_instructions%': 'false',
+
+    # Setting v8_use_arm_eabi_hardfloat to true will turn on V8 support for ARM
+    # EABI calling convention where double arguments are passed in VFP
+    # registers. Note that the GCC flag '-mfloat-abi=hard' should be used as
+    # well when compiling for the ARM target.
+    'v8_use_arm_eabi_hardfloat%': 'false',
+
+    'v8_use_snapshot%': 'true',
+    'host_os%': '<(OS)',
+    'v8_use_liveobjectlist%': 'false',
+  },
+  'target_defaults': {
+    'conditions': [
+      ['OS!="mac"', {
+        'conditions': [
+          ['v8_target_arch=="arm"', {
+            'defines': [
+              'V8_TARGET_ARCH_ARM',
+            ],
+            'conditions': [
+              [ 'v8_can_use_unaligned_accesses=="true"', {
+                'defines': [
+                  'CAN_USE_UNALIGNED_ACCESSES=1',
+                ],
+              }],
+              [ 'v8_can_use_unaligned_accesses=="false"', {
+                'defines': [
+                  'CAN_USE_UNALIGNED_ACCESSES=0',
+                ],
+              }],
+              [ 'v8_can_use_vfp_instructions=="true"', {
+                'defines': [
+                  'CAN_USE_VFP_INSTRUCTIONS',
+                ],
+              }],
+              [ 'v8_use_arm_eabi_hardfloat=="true"', {
+                'defines': [
+                  'USE_EABI_HARDFLOAT=1',
+                  'CAN_USE_VFP_INSTRUCTIONS',
+                ],
+              }],
+            ],
+          }],
+          ['v8_target_arch=="ia32"', {
+            'defines': [
+              'V8_TARGET_ARCH_IA32',
+            ],
+          }],
+          ['v8_target_arch=="mips"', {
+            'defines': [
+              'V8_TARGET_ARCH_MIPS',
+            ],
+          }],
+          ['v8_target_arch=="x64"', {
+            'defines': [
+              'V8_TARGET_ARCH_X64',
+            ],
+          }],
+        ],
+      }],
+    ],
+    'configurations': {
+      'Debug': {
+        'defines': [
+          'DEBUG',
+          '_DEBUG',
+          'ENABLE_DISASSEMBLER',
+          'V8_ENABLE_CHECKS',
+          'OBJECT_PRINT',
+        ],
+      }
+    }
+  }
+}