diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index a04811d3c12c938d166dd8db5f6f020203177e8d..656c4b353dab3b0d318bd86bca48e82fda55d190 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -40,6 +40,7 @@ shell_g /test/test262/data /test/test262/test262-* /test/test262/test262.status2 +/test/webkit/webkit.status2 /third_party /tools/jsfunfuzz /tools/jsfunfuzz.zip diff --git a/deps/v8/ChangeLog b/deps/v8/ChangeLog index 6117e56b7691faa0c619d973d750de984b85d403..3c113b2f75b2c1af6cfe7ad89dcca0b9d51c0953 100644 --- a/deps/v8/ChangeLog +++ b/deps/v8/ChangeLog @@ -1,3 +1,92 @@ +2013-07-05: Version 3.20.2 + + Remove deprecated heap profiler methods from V8 public API + + Mark i18n functions as native and set proper names + (issue 2745) + + Correctly report stack trace when current function is FunctionApply + builtin (Chromium issue 252097) + + Enable GDBJIT interface for standalone by default. + + Fix debuggersupport=off build. (issue 2754) + + Introduce -m64 flag for making x64 when the default gcc compiler is for + X32 + + Performance and stability improvements on all platforms. + + +2013-07-02: Version 3.20.1 + + Implemented WeakMap.prototype.clear function. (issue 2753) + + Ensure CheckInitialized is present independent of define. + (Chromium issue 255779) + + Performance and stability improvements on all platforms. + + +2013-06-28: Version 3.20.0 + + Migrated several tests from blink to V8 repository. + + Allowed users of the V8 API to distinguish between unset and undefined + HiddenValues (issue 2746). + + Deprecated old style callbacks in the V8 API. + + Turned on parallel recompilation. + + Performance and stability improvements on all platforms. + + +2013-06-18: Version 3.19.18 + + Fixed read-only attribute of Function.length in strict mode. + (issue 2705) + + Fixed Runtime_SetProperty to properly handle OOM failures + (Chromium issue 249873) + + Emit deprecated check for constant function transitions. + (Chromium issue 250609) + + Made MathFloorOfDiv optimization trigger more often + (Issue 2205) + + Make more GCs in idle notification handler. + (Chromium issue 241815) + + Increased default type info threshold. + (Issue 2730) + + Performance and stability improvements on all platforms. + + +2013-06-14: Version 3.19.16 + + Performance and stability improvements on all platforms. + + +2013-06-13: Version 3.19.15 + + Performance and stability improvements on all platforms. + + +2013-06-13: Version 3.19.14 + + Fixed crashes when calling new Array(a) with a single argument that + could result in creating a holey array with a packed elements kind. + (Chromium issue 245480) + + Fixed issues in parallel compilation. + (Chromium issue 248076) + + Performance and stability improvements on all platforms. + + 2013-06-11: Version 3.19.13 Performance and stability improvements on all platforms. diff --git a/deps/v8/DEPS b/deps/v8/DEPS index 8d66960f2d7f483929615ba7f5f99cb72e75f795..4f1a5cfb267670ee0fc4868363bef61d2769fc9d 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -5,7 +5,10 @@ deps = { # Remember to keep the revision in sync with the Makefile. "v8/build/gyp": - "http://gyp.googlecode.com/svn/trunk@1501", + "http://gyp.googlecode.com/svn/trunk@1656", + + "v8/third_party/icu": + "https://src.chromium.org/chrome/trunk/deps/third_party/icu46@205936", } deps_os = { diff --git a/deps/v8/Makefile b/deps/v8/Makefile index a46b333f1ebeb5b345e10d2f7f834d5da21fc912..16c004f32d00d11ec16008323034f4baf4ada80c 100644 --- a/deps/v8/Makefile +++ b/deps/v8/Makefile @@ -35,7 +35,7 @@ GYPFLAGS ?= TESTFLAGS ?= ANDROID_NDK_ROOT ?= ANDROID_TOOLCHAIN ?= -ANDROID_V8 ?= /data/local/v8 +ANDROID_V8 ?= /data/local/tmp/v8 NACL_SDK_ROOT ?= # Special build flags. Use them like this: "make library=shared" @@ -80,10 +80,13 @@ endif ifeq ($(extrachecks), off) GYPFLAGS += -Dv8_enable_extra_checks=0 endif -# gdbjit=on +# gdbjit=on/off ifeq ($(gdbjit), on) GYPFLAGS += -Dv8_enable_gdbjit=1 endif +ifeq ($(gdbjit), off) + GYPFLAGS += -Dv8_enable_gdbjit=0 +endif # vtunejit=on ifeq ($(vtunejit), on) GYPFLAGS += -Dv8_enable_vtunejit=1 @@ -116,6 +119,10 @@ endif ifeq ($(regexp), interpreted) GYPFLAGS += -Dv8_interpreted_regexp=1 endif +# i18nsupport=on +ifeq ($(i18nsupport), on) + GYPFLAGS += -Dv8_enable_i18n_support=1 +endif # arm specific flags. # armv7=false/true ifeq ($(armv7), false) @@ -391,4 +398,7 @@ $(ENVFILE).new: # Remember to keep these in sync with the DEPS file. dependencies: svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ - --revision 1501 + --revision 1656 + svn checkout --force \ + https://src.chromium.org/chrome/trunk/deps/third_party/icu46 \ + third_party/icu --revision 205936 diff --git a/deps/v8/OWNERS b/deps/v8/OWNERS index 0333d151848c3532f6da603f23037c29b24f461b..6fe40e21e33533fbe3b9561d82fc5cbe0beeb24b 100644 --- a/deps/v8/OWNERS +++ b/deps/v8/OWNERS @@ -1,3 +1,4 @@ +bmeurer@chromium.org danno@chromium.org dslomov@chromium.org hpayer@chromium.org diff --git a/deps/v8/build/android.gypi b/deps/v8/build/android.gypi index 8400ab113ab3c72cd7a3059577040526dfef5458..ca097255bbb5ce4deb018d5d95743af22af67b7c 100644 --- a/deps/v8/build/android.gypi +++ b/deps/v8/build/android.gypi @@ -75,15 +75,8 @@ ], 'configurations': { 'Release': { - 'cflags!': [ - '-O2', - '-Os', - ], 'cflags': [ - '-fdata-sections', - '-ffunction-sections', '-fomit-frame-pointer', - '-O3', ], }, # Release }, # configurations diff --git a/deps/v8/build/common.gypi b/deps/v8/build/common.gypi index c7849e26aff6f8cd949aa0ff7937b99bc092bdff..dbb33a867bfb9abd6aaeb88a542aa69b168c082d 100644 --- a/deps/v8/build/common.gypi +++ b/deps/v8/build/common.gypi @@ -104,6 +104,10 @@ # Interpreted regexp engine exists as platform-independent alternative # based where the regular expression is compiled to a bytecode. 'v8_interpreted_regexp%': 0, + + # Enable ECMAScript Internationalization API. Enabling this feature will + # add a dependency on the ICU library. + 'v8_enable_i18n_support%': 0, }, 'target_defaults': { 'conditions': [ @@ -125,6 +129,9 @@ ['v8_interpreted_regexp==1', { 'defines': ['V8_INTERPRETED_REGEXP',], }], + ['v8_enable_i18n_support==1', { + 'defines': ['V8_I18N_SUPPORT',], + }], ['v8_target_arch=="arm"', { 'defines': [ 'V8_TARGET_ARCH_ARM', @@ -452,6 +459,26 @@ }], ], }], + ['(OS=="linux") and (v8_target_arch=="x64")', { + # Check whether the host compiler and target compiler support the + # '-m64' option and set it if so. + 'target_conditions': [ + ['_toolset=="host"', { + 'variables': { + 'm64flag': ' /dev/null 2>&1) && echo "-m64" || true)', + }, + 'cflags': [ '<(m64flag)' ], + 'ldflags': [ '<(m64flag)' ], + }], + ['_toolset=="target"', { + 'variables': { + 'm64flag': ' /dev/null 2>&1) && echo "-m64" || true)', + }, + 'cflags': [ '<(m64flag)' ], + 'ldflags': [ '<(m64flag)' ], + }] + ], + }], ['OS=="freebsd" or OS=="openbsd"', { 'cflags': [ '-I/usr/local/include' ], }], @@ -528,8 +555,35 @@ ['v8_enable_extra_checks==1', { 'defines': ['ENABLE_EXTRA_CHECKS',], }], - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \ - or OS=="android"', { + ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { + 'cflags!': [ + '-O2', + '-Os', + ], + 'cflags': [ + '-fdata-sections', + '-ffunction-sections', + '-O3', + ], + 'conditions': [ + [ 'gcc_version==44 and clang==0', { + 'cflags': [ + # Avoid crashes with gcc 4.4 in the v8 test suite. + '-fno-tree-vrp', + ], + }], + ], + }], + ['OS=="android"', { + 'cflags!': [ + '-O3', + '-Os', + ], + 'cflags': [ + '-fdata-sections', + '-ffunction-sections', + '-O2', + ], 'conditions': [ [ 'gcc_version==44 and clang==0', { 'cflags': [ diff --git a/deps/v8/build/shim_headers.gypi b/deps/v8/build/shim_headers.gypi new file mode 100644 index 0000000000000000000000000000000000000000..940211c2401c43869c8ca3281db6e1b622cfbbdc --- /dev/null +++ b/deps/v8/build/shim_headers.gypi @@ -0,0 +1,73 @@ +# Copyright 2013 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. + +# This file is meant to be included into a target to handle shim headers +# in a consistent manner. To use this the following variables need to be +# defined: +# headers_root_path: string: path to directory containing headers +# header_filenames: list: list of header file names + +{ + 'variables': { + 'shim_headers_path': '<(SHARED_INTERMEDIATE_DIR)/shim_headers/<(_target_name)/<(_toolset)', + 'shim_generator_additional_args%': [], + }, + 'include_dirs++': [ + '<(shim_headers_path)', + ], + 'all_dependent_settings': { + 'include_dirs+++': [ + '<(shim_headers_path)', + ], + }, + 'actions': [ + { + 'variables': { + 'generator_path': '<(DEPTH)/tools/generate_shim_headers/generate_shim_headers.py', + 'generator_args': [ + '--headers-root', '<(headers_root_path)', + '--output-directory', '<(shim_headers_path)', + '<@(shim_generator_additional_args)', + '<@(header_filenames)', + ], + }, + 'action_name': 'generate_<(_target_name)_shim_headers', + 'inputs': [ + '<(generator_path)', + ], + 'outputs': [ + ' GetFunctionName() const; + /** Returns id of the script where function is located. */ + int GetScriptId() const; + /** Returns resource name for script from where the function originates. */ Handle GetScriptResourceName() const; @@ -172,18 +175,12 @@ class V8EXPORT CpuProfiler { * obtaining profiling results. */ - /** Deprecated. Use GetProfileCount instead. */ - V8_DEPRECATED(static int GetProfilesCount()); /** * Returns the number of profiles collected (doesn't include * profiles that are being collected at the moment of call.) */ int GetProfileCount(); - /** Deprecated. Use GetCpuProfile instead. */ - V8_DEPRECATED(static const CpuProfile* GetProfile( - int index, - Handle security_token = Handle())); /** Deprecated. Use GetCpuProfile with single parameter. */ V8_DEPRECATED(const CpuProfile* GetCpuProfile( int index, @@ -191,18 +188,11 @@ class V8EXPORT CpuProfiler { /** Returns a profile by index. */ const CpuProfile* GetCpuProfile(int index); - /** Deprecated. Use FindProfile instead. */ - V8_DEPRECATED(static const CpuProfile* FindProfile( - unsigned uid, - Handle security_token = Handle())); /** Returns a profile by uid. */ V8_DEPRECATED(const CpuProfile* FindCpuProfile( unsigned uid, Handle security_token = Handle())); - /** Deprecated. Use StartCpuProfiling instead. */ - V8_DEPRECATED(static void StartProfiling(Handle title, - bool record_samples = false)); /** * Starts collecting CPU profile. Title may be an empty string. It * is allowed to have several profiles being collected at @@ -216,10 +206,6 @@ class V8EXPORT CpuProfiler { */ void StartCpuProfiling(Handle title, bool record_samples = false); - /** Deprecated. Use StopCpuProfiling instead. */ - V8_DEPRECATED(static const CpuProfile* StopProfiling( - Handle title, - Handle security_token = Handle())); /** * Deprecated. Use StopCpuProfiling with one parameter instead. */ @@ -232,8 +218,6 @@ class V8EXPORT CpuProfiler { */ const CpuProfile* StopCpuProfiling(Handle title); - /** Deprecated. Use DeleteAllCpuProfiles instead. */ - V8_DEPRECATED(static void DeleteAllProfiles()); /** * Deletes all existing profiles, also cancelling all profiling * activity. All previously returned pointers to profiles and their @@ -346,16 +330,10 @@ class V8EXPORT HeapGraphNode { */ class V8EXPORT HeapSnapshot { public: - enum Type { - kFull = 0 // Heap snapshot with all instances and references. - }; enum SerializationFormat { kJSON = 0 // See format description near 'Serialize' method. }; - /** Deprecated. Returns kFull. */ - V8_DEPRECATED(Type GetType() const); - /** Returns heap snapshot UID (assigned by the profiler.) */ unsigned GetUid() const; @@ -431,24 +409,12 @@ class V8EXPORT HeapProfiler { typedef RetainedObjectInfo* (*WrapperInfoCallback) (uint16_t class_id, Handle wrapper); - /** Deprecated. Use GetSnapshotCount instead. */ - V8_DEPRECATED(static int GetSnapshotsCount()); /** Returns the number of snapshots taken. */ int GetSnapshotCount(); - /** Deprecated. Use GetHeapSnapshot instead. */ - V8_DEPRECATED(static const HeapSnapshot* GetSnapshot(int index)); /** Returns a snapshot by index. */ const HeapSnapshot* GetHeapSnapshot(int index); - /** Deprecated. Use FindHeapSnapshot instead. */ - V8_DEPRECATED(static const HeapSnapshot* FindSnapshot(unsigned uid)); - /** Returns a profile by uid. */ - V8_DEPRECATED(const HeapSnapshot* FindHeapSnapshot(unsigned uid)); - - /** Deprecated. Use GetObjectId instead. */ - V8_DEPRECATED(static SnapshotObjectId GetSnapshotObjectId( - Handle value)); /** * Returns SnapshotObjectId for a heap object referenced by |value| if * it has been seen by the heap profiler, kUnknownObjectId otherwise. @@ -476,12 +442,6 @@ class V8EXPORT HeapProfiler { virtual ~ObjectNameResolver() {} }; - /** Deprecated. Use TakeHeapSnapshot instead. */ - V8_DEPRECATED(static const HeapSnapshot* TakeSnapshot( - Handle title, - HeapSnapshot::Type type = HeapSnapshot::kFull, - ActivityControl* control = NULL, - ObjectNameResolver* global_object_name_resolver = NULL)); /** * Takes a heap snapshot and returns it. Title may be an empty string. */ @@ -490,9 +450,6 @@ class V8EXPORT HeapProfiler { ActivityControl* control = NULL, ObjectNameResolver* global_object_name_resolver = NULL); - - /** Deprecated. Use StartTrackingHeapObjects instead. */ - V8_DEPRECATED(static void StartHeapObjectsTracking()); /** * Starts tracking of heap objects population statistics. After calling * this method, all heap objects relocations done by the garbage collector @@ -500,9 +457,6 @@ class V8EXPORT HeapProfiler { */ void StartTrackingHeapObjects(); - /** Deprecated. Use GetHeapStats instead. */ - V8_DEPRECATED(static SnapshotObjectId PushHeapObjectsStats( - OutputStream* stream)); /** * Adds a new time interval entry to the aggregated statistics array. The * time interval entry contains information on the current heap objects @@ -517,8 +471,6 @@ class V8EXPORT HeapProfiler { */ SnapshotObjectId GetHeapStats(OutputStream* stream); - /** Deprecated. Use StopTrackingHeapObjects instead. */ - V8_DEPRECATED(static void StopHeapObjectsTracking()); /** * Stops tracking of heap objects population statistics, cleans up all * collected data. StartHeapObjectsTracking must be called again prior to @@ -526,18 +478,12 @@ class V8EXPORT HeapProfiler { */ void StopTrackingHeapObjects(); - /** Deprecated. Use DeleteAllHeapSnapshots instead. */ - V8_DEPRECATED(static void DeleteAllSnapshots()); /** * Deletes all snapshots taken. All previously returned pointers to * snapshots and their contents become invalid after this call. */ void DeleteAllHeapSnapshots(); - /** Deprecated. Use SetWrapperClassInfoProvider instead. */ - V8_DEPRECATED(static void DefineWrapperClass( - uint16_t class_id, - WrapperInfoCallback callback)); /** Binds a callback to embedder's class ID. */ void SetWrapperClassInfoProvider( uint16_t class_id, @@ -550,13 +496,6 @@ class V8EXPORT HeapProfiler { */ static const uint16_t kPersistentHandleNoClassId = 0; - /** - * Deprecated. Returns the number of currently existing persistent handles. - */ - V8_DEPRECATED(static int GetPersistentHandleCount()); - - /** Deprecated. Use GetHeapProfilerMemorySize instead. */ - V8_DEPRECATED(static size_t GetMemorySizeUsedByProfiler()); /** Returns memory used for profiler internal data and snapshots. */ size_t GetProfilerMemorySize(); @@ -590,7 +529,7 @@ class V8EXPORT HeapProfiler { * objects for heap snapshots, he can do it in a GC prologue * handler, and / or by assigning wrapper class ids in the following way: * - * 1. Bind a callback to class id by calling DefineWrapperClass. + * 1. Bind a callback to class id by calling SetWrapperClassInfoProvider. * 2. Call SetWrapperClassId on certain persistent handles. * * V8 takes ownership of RetainedObjectInfo instances passed to it and diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index c0bec79b01f1123d7926fe14a7fb0dec8dbf5810..3afb83572a903e690e377c2b8bce5f900e60404d 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -123,7 +123,6 @@ class ImplementationUtilities; class Int32; class Integer; class Isolate; -class LocalContext; class Number; class NumberObject; class Object; @@ -155,6 +154,7 @@ class Isolate; class DeclaredAccessorDescriptor; class ObjectOperationDescriptor; class RawOperationDescriptor; +class CallHandlerHelper; namespace internal { class Arguments; @@ -162,8 +162,7 @@ class Heap; class HeapObject; class Isolate; class Object; -template -class CustomArguments; +template class CustomArguments; class PropertyCallbackArguments; class FunctionCallbackArguments; } @@ -222,8 +221,6 @@ class WeakReferenceCallbacks { } -#define V8_USE_UNSAFE_HANDLES - /** * An object reference managed by the v8 garbage collector. * @@ -365,21 +362,19 @@ template class Handle { #endif private: + friend class Utils; template friend class Persistent; template friend class Local; friend class Arguments; template friend class FunctionCallbackInfo; template friend class PropertyCallbackInfo; - friend class String; - friend class Object; + template friend class internal::CustomArguments; friend class AccessorInfo; friend Handle Undefined(Isolate* isolate); friend Handle Null(Isolate* isolate); friend Handle True(Isolate* isolate); friend Handle False(Isolate* isolate); friend class Context; - friend class InternalHandleHelper; - friend class LocalContext; friend class HandleScope; #ifndef V8_USE_UNSAFE_HANDLES @@ -454,6 +449,7 @@ template class Local : public Handle { #endif private: + friend class Utils; template friend class Persistent; template friend class Handle; friend class Arguments; @@ -463,8 +459,7 @@ template class Local : public Handle { friend class Object; friend class AccessorInfo; friend class Context; - friend class InternalHandleHelper; - friend class LocalContext; + template friend class internal::CustomArguments; friend class HandleScope; V8_INLINE(static Local New(Isolate* isolate, T* that)); @@ -496,10 +491,10 @@ template class Persistent // NOLINT public: #ifndef V8_USE_UNSAFE_HANDLES V8_INLINE(Persistent()) : val_(0) { } - V8_INLINE(~Persistent()) { - // TODO(dcarney): add this back before cutover. - // Dispose(); - } + // TODO(dcarney): add this back before cutover. +// V8_INLINE(~Persistent()) { +// Dispose(); +// } V8_INLINE(bool IsEmpty() const) { return val_ == 0; } // TODO(dcarney): remove somehow before cutover // The handle should either be 0, or a pointer to a live cell. @@ -511,11 +506,11 @@ template class Persistent // NOLINT * to be separately disposed. */ template V8_INLINE(Persistent(Isolate* isolate, Handle that)) - : val_(*New(isolate, that)) { } + : val_(New(isolate, *that)) { } template V8_INLINE(Persistent(Isolate* isolate, - Persistent& that)) // NOLINT - : val_(*New(isolate, that)) { } + const Persistent& that)) // NOLINT + : val_(New(isolate, *that)) { } #else /** @@ -594,15 +589,9 @@ template class Persistent // NOLINT } #endif +#ifdef V8_USE_UNSAFE_HANDLES V8_DEPRECATED(static Persistent New(Handle that)); - - /** - * Creates a new persistent handle for an existing local or persistent handle. - */ - // TODO(dcarney): remove before cutover V8_INLINE(static Persistent New(Isolate* isolate, Handle that)); -#ifndef V8_USE_UNSAFE_HANDLES - // TODO(dcarney): remove before cutover V8_INLINE(static Persistent New(Isolate* isolate, Persistent that)); #endif @@ -652,23 +641,17 @@ template class Persistent // NOLINT P* parameters, typename WeakReferenceCallbacks::Revivable callback)); - // TODO(dcarney): deprecate template - V8_INLINE(void MakeWeak( + V8_DEPRECATED(void MakeWeak( Isolate* isolate, P* parameters, - typename WeakReferenceCallbacks::Revivable callback)) { - MakeWeak(parameters, callback); - } + typename WeakReferenceCallbacks::Revivable callback)); - // TODO(dcarney): deprecate template - V8_INLINE(void MakeWeak( + V8_DEPRECATED(void MakeWeak( Isolate* isolate, P* parameters, - typename WeakReferenceCallbacks::Revivable callback)) { - MakeWeak

(parameters, callback); - } + typename WeakReferenceCallbacks::Revivable callback)); V8_INLINE(void ClearWeak()); @@ -779,11 +762,7 @@ template class Persistent // NOLINT #endif // TODO(dcarney): remove before cutover template V8_INLINE(Persistent(S* that)) : val_(that) { } - // TODO(dcarney): remove before cutover - template V8_INLINE(Persistent(Persistent that)) - : val_(*that) { - TYPE_CHECK(T, S); - } + // TODO(dcarney): remove before cutover V8_INLINE(T* operator*() const) { return val_; } @@ -794,16 +773,13 @@ template class Persistent // NOLINT #endif private: + friend class Utils; template friend class Handle; template friend class Local; + template friend class Persistent; template friend class ReturnValue; - friend class ImplementationUtilities; - friend class ObjectTemplate; - friend class Context; - friend class InternalHandleHelper; - friend class LocalContext; - V8_INLINE(static Persistent New(Isolate* isolate, T* that)); + V8_INLINE(static T* New(Isolate* isolate, T* that)); #ifndef V8_USE_UNSAFE_HANDLES T* val_; @@ -1067,9 +1043,15 @@ class V8EXPORT Script { /** * Returns the script id value. + * DEPRECATED: Please use GetId(). */ Local Id(); + /** + * Returns the script id. + */ + int GetId(); + /** * Associate an additional data object with the script. This is mainly used * with the debugger as this data object is only available through the @@ -1087,6 +1069,8 @@ class V8EXPORT Script { * -1 will be returned if no information available. */ int GetLineNumber(int code_pos); + + static const int kNoScriptId = 0; }; @@ -1385,6 +1369,12 @@ class V8EXPORT Value : public Data { */ bool IsArrayBuffer() const; + /** + * Returns true if this value is an ArrayBufferView. + * This is an experimental feature. + */ + bool IsArrayBufferView() const; + /** * Returns true if this value is one of TypedArrays. * This is an experimental feature. @@ -1445,6 +1435,12 @@ class V8EXPORT Value : public Data { */ bool IsFloat64Array() const; + /** + * Returns true if this value is a DataView. + * This is an experimental feature. + */ + bool IsDataView() const; + Local ToBoolean() const; Local ToNumber() const; Local ToString() const; @@ -2078,13 +2074,12 @@ class V8EXPORT Object : public Value { bool Delete(uint32_t index); - // TODO(dcarney): deprecate - bool SetAccessor(Handle name, - AccessorGetter getter, - AccessorSetter setter = 0, - Handle data = Handle(), - AccessControl settings = DEFAULT, - PropertyAttribute attribute = None); + V8_DEPRECATED(bool SetAccessor(Handle name, + AccessorGetter getter, + AccessorSetter setter = 0, + Handle data = Handle(), + AccessControl settings = DEFAULT, + PropertyAttribute attribute = None)); bool SetAccessor(Handle name, AccessorGetterCallback getter, AccessorSetterCallback setter = 0, @@ -2360,7 +2355,18 @@ class V8EXPORT Function : public Object { * kLineOffsetNotFound if no information available. */ int GetScriptColumnNumber() const; + + /** + * Returns scriptId object. + * DEPRECATED: use ScriptId() instead. + */ Handle GetScriptId() const; + + /** + * Returns scriptId. + */ + int ScriptId() const; + ScriptOrigin GetScriptOrigin() const; V8_INLINE(static Function* Cast(Value* obj)); static const int kLineOffsetNotFound; @@ -2484,33 +2490,51 @@ class V8EXPORT ArrayBuffer : public Object { /** - * A base class for an instance of TypedArray series of constructors - * (ES6 draft 15.13.6). + * A base class for an instance of one of "views" over ArrayBuffer, + * including TypedArrays and DataView (ES6 draft 15.13). + * * This API is experimental and may change significantly. */ -class V8EXPORT TypedArray : public Object { +class V8EXPORT ArrayBufferView : public Object { public: /** * Returns underlying ArrayBuffer. */ Local Buffer(); /** - * Byte offset in |Buffer| + * Byte offset in |Buffer|. */ size_t ByteOffset(); /** - * Numbe of elements in this typed array. - */ - size_t Length(); - /** - * Size of typed array in bytes (e.g. for Int16Array, 2*|Length|). + * Size of a view in bytes. */ size_t ByteLength(); /** - * Base address of typed array. + * Base address of a view. */ void* BaseAddress(); + V8_INLINE(static ArrayBufferView* Cast(Value* obj)); + + private: + ArrayBufferView(); + static void CheckCast(Value* obj); +}; + + +/** + * A base class for an instance of TypedArray series of constructors + * (ES6 draft 15.13.6). + * This API is experimental and may change significantly. + */ +class V8EXPORT TypedArray : public ArrayBufferView { + public: + /** + * Number of elements in this typed array + * (e.g. for Int16Array, |ByteLength|/2). + */ + size_t Length(); + V8_INLINE(static TypedArray* Cast(Value* obj)); private: @@ -2662,6 +2686,22 @@ class V8EXPORT Float64Array : public TypedArray { }; +/** + * An instance of DataView constructor (ES6 draft 15.13.7). + * This API is experimental and may change significantly. + */ +class V8EXPORT DataView : public ArrayBufferView { + public: + static Local New(Handle array_buffer, + size_t byte_offset, size_t length); + V8_INLINE(static DataView* Cast(Value* obj)); + + private: + DataView(); + static void CheckCast(Value* obj); +}; + + /** * An instance of the built-in Date constructor (ECMA-262, 15.9). */ @@ -3220,14 +3260,13 @@ typedef bool (*IndexedSecurityCallback)(Local host, class V8EXPORT FunctionTemplate : public Template { public: /** Creates a function template.*/ - // TODO(dcarney): deprecate - static Local New( - InvocationCallback callback = 0, + V8_DEPRECATED(static Local New( + InvocationCallback callback, Handle data = Handle(), Handle signature = Handle(), - int length = 0); + int length = 0)); static Local New( - FunctionCallback callback, // TODO(dcarney): add back default param. + FunctionCallback callback = 0, Handle data = Handle(), Handle signature = Handle(), int length = 0); @@ -3240,9 +3279,8 @@ class V8EXPORT FunctionTemplate : public Template { * callback is called whenever the function created from this * FunctionTemplate is called. */ - // TODO(dcarney): deprecate - void SetCallHandler(InvocationCallback callback, - Handle data = Handle()); + V8_DEPRECATED(void SetCallHandler(InvocationCallback callback, + Handle data = Handle())); void SetCallHandler(FunctionCallback callback, Handle data = Handle()); @@ -3296,6 +3334,9 @@ class V8EXPORT FunctionTemplate : public Template { private: FunctionTemplate(); + // TODO(dcarney): Remove with SetCallHandler. + friend class v8::CallHandlerHelper; + void SetCallHandlerInternal(InvocationCallback callback, Handle data); friend class Context; friend class ObjectTemplate; }; @@ -3344,15 +3385,14 @@ class V8EXPORT ObjectTemplate : public Template { * defined by FunctionTemplate::HasInstance()), an implicit TypeError is * thrown and no callback is invoked. */ - // TODO(dcarney): deprecate - void SetAccessor(Handle name, - AccessorGetter getter, - AccessorSetter setter = 0, - Handle data = Handle(), - AccessControl settings = DEFAULT, - PropertyAttribute attribute = None, - Handle signature = - Handle()); + V8_DEPRECATED(void SetAccessor(Handle name, + AccessorGetter getter, + AccessorSetter setter = 0, + Handle data = Handle(), + AccessControl settings = DEFAULT, + PropertyAttribute attribute = None, + Handle signature = + Handle())); void SetAccessor(Handle name, AccessorGetterCallback getter, AccessorSetterCallback setter = 0, @@ -3387,13 +3427,13 @@ class V8EXPORT ObjectTemplate : public Template { * \param data A piece of data that will be passed to the callbacks * whenever they are invoked. */ - // TODO(dcarney): deprecate - void SetNamedPropertyHandler(NamedPropertyGetter getter, - NamedPropertySetter setter = 0, - NamedPropertyQuery query = 0, - NamedPropertyDeleter deleter = 0, - NamedPropertyEnumerator enumerator = 0, - Handle data = Handle()); + V8_DEPRECATED(void SetNamedPropertyHandler( + NamedPropertyGetter getter, + NamedPropertySetter setter = 0, + NamedPropertyQuery query = 0, + NamedPropertyDeleter deleter = 0, + NamedPropertyEnumerator enumerator = 0, + Handle data = Handle())); void SetNamedPropertyHandler( NamedPropertyGetterCallback getter, NamedPropertySetterCallback setter = 0, @@ -3418,13 +3458,13 @@ class V8EXPORT ObjectTemplate : public Template { * \param data A piece of data that will be passed to the callbacks * whenever they are invoked. */ - // TODO(dcarney): deprecate - void SetIndexedPropertyHandler(IndexedPropertyGetter getter, - IndexedPropertySetter setter = 0, - IndexedPropertyQuery query = 0, - IndexedPropertyDeleter deleter = 0, - IndexedPropertyEnumerator enumerator = 0, - Handle data = Handle()); + V8_DEPRECATED(void SetIndexedPropertyHandler( + IndexedPropertyGetter getter, + IndexedPropertySetter setter = 0, + IndexedPropertyQuery query = 0, + IndexedPropertyDeleter deleter = 0, + IndexedPropertyEnumerator enumerator = 0, + Handle data = Handle())); void SetIndexedPropertyHandler( IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter = 0, @@ -3439,9 +3479,9 @@ class V8EXPORT ObjectTemplate : public Template { * behave like normal JavaScript objects that cannot be called as a * function. */ - // TODO(dcarney): deprecate - void SetCallAsFunctionHandler(InvocationCallback callback, - Handle data = Handle()); + V8_DEPRECATED(void SetCallAsFunctionHandler( + InvocationCallback callback, + Handle data = Handle())); void SetCallAsFunctionHandler(FunctionCallback callback, Handle data = Handle()); @@ -3953,8 +3993,9 @@ class V8EXPORT Isolate { HeapProfiler* GetHeapProfiler(); /** - * Returns CPU profiler for this isolate. Will return NULL until the isolate - * is initialized. + * Returns CPU profiler for this isolate. Will return NULL unless the isolate + * is initialized. It is the embedder's responsibility to stop all CPU + * profiling activities if it has started any. */ CpuProfiler* GetCpuProfiler(); @@ -4436,19 +4477,26 @@ class V8EXPORT V8 { static void SetReturnAddressLocationResolver( ReturnAddressLocationResolver return_address_resolver); + /** + * Deprecated, use the variant with the Isolate parameter below instead. + */ + V8_DEPRECATED(static bool SetFunctionEntryHook(FunctionEntryHook entry_hook)); + /** * Allows the host application to provide the address of a function that's * invoked on entry to every V8-generated function. * Note that \p entry_hook is invoked at the very start of each * generated function. * + * \param isolate the isolate to operate on. * \param entry_hook a function that will be invoked on entry to every * V8-generated function. * \returns true on success on supported platforms, false on failure. - * \note Setting a new entry hook function when one is already active will - * fail. + * \note Setting an entry hook can only be done very early in an isolates + * lifetime, and once set, the entry hook cannot be revoked. */ - static bool SetFunctionEntryHook(FunctionEntryHook entry_hook); + static bool SetFunctionEntryHook(Isolate* isolate, + FunctionEntryHook entry_hook); /** * Allows the host application to provide the address of a function that is @@ -4776,7 +4824,10 @@ class V8EXPORT TryCatch { v8::internal::Isolate* isolate_; void* next_; void* exception_; - void* message_; + void* message_obj_; + void* message_script_; + int message_start_pos_; + int message_end_pos_; bool is_verbose_ : 1; bool can_continue_ : 1; bool capture_message_ : 1; @@ -5320,20 +5371,19 @@ class Internals { static const int kJSObjectHeaderSize = 3 * kApiPointerSize; static const int kFixedArrayHeaderSize = 2 * kApiPointerSize; static const int kContextHeaderSize = 2 * kApiPointerSize; - static const int kContextEmbedderDataIndex = 64; + static const int kContextEmbedderDataIndex = 65; static const int kFullStringRepresentationMask = 0x07; static const int kStringEncodingMask = 0x4; static const int kExternalTwoByteRepresentationTag = 0x02; static const int kExternalAsciiRepresentationTag = 0x06; - static const int kIsolateStateOffset = 0; static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; static const int kIsolateRootsOffset = 3 * kApiPointerSize; static const int kUndefinedValueRootIndex = 5; static const int kNullValueRootIndex = 7; static const int kTrueValueRootIndex = 8; static const int kFalseValueRootIndex = 9; - static const int kEmptyStringRootIndex = 130; + static const int kEmptyStringRootIndex = 131; static const int kNodeClassIdOffset = 1 * kApiPointerSize; static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; @@ -5343,14 +5393,21 @@ class Internals { static const int kNodeIsIndependentShift = 4; static const int kNodeIsPartiallyDependentShift = 5; - static const int kJSObjectType = 0xaf; + static const int kJSObjectType = 0xb0; static const int kFirstNonstringType = 0x80; static const int kOddballType = 0x83; - static const int kForeignType = 0x87; + static const int kForeignType = 0x88; static const int kUndefinedOddballKind = 5; static const int kNullOddballKind = 3; + static void CheckInitializedImpl(v8::Isolate* isolate); + V8_INLINE(static void CheckInitialized(v8::Isolate* isolate)) { +#ifdef V8_ENABLE_CHECKS + CheckInitializedImpl(isolate); +#endif + } + V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) { return ((reinterpret_cast(value) & kHeapObjectTagMask) == kHeapObjectTag); @@ -5384,11 +5441,6 @@ class Internals { return representation == kExternalTwoByteRepresentationTag; } - V8_INLINE(static bool IsInitialized(v8::Isolate* isolate)) { - uint8_t* addr = reinterpret_cast(isolate) + kIsolateStateOffset; - return *reinterpret_cast(addr) == 1; - } - V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) { uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; return *addr & (1 << shift); @@ -5510,6 +5562,7 @@ Local Local::New(Isolate* isolate, T* that) { } +#ifdef V8_USE_UNSAFE_HANDLES template Persistent Persistent::New(Handle that) { return New(Isolate::GetCurrent(), that.val_); @@ -5521,20 +5574,20 @@ Persistent Persistent::New(Isolate* isolate, Handle that) { return New(Isolate::GetCurrent(), that.val_); } -#ifndef V8_USE_UNSAFE_HANDLES template Persistent Persistent::New(Isolate* isolate, Persistent that) { return New(Isolate::GetCurrent(), that.val_); } #endif + template -Persistent Persistent::New(Isolate* isolate, T* that) { - if (that == NULL) return Persistent(); +T* Persistent::New(Isolate* isolate, T* that) { + if (that == NULL) return NULL; internal::Object** p = reinterpret_cast(that); - return Persistent(reinterpret_cast( + return reinterpret_cast( V8::GlobalizeReference(reinterpret_cast(isolate), - p))); + p)); } @@ -5597,6 +5650,26 @@ void Persistent::MakeWeak( } +template +template +void Persistent::MakeWeak( + Isolate* isolate, + P* parameters, + typename WeakReferenceCallbacks::Revivable callback) { + MakeWeak(parameters, callback); +} + + +template +template +void Persistent::MakeWeak( + Isolate* isolate, + P* parameters, + typename WeakReferenceCallbacks::Revivable callback) { + MakeWeak

(parameters, callback); +} + + template void Persistent::ClearWeak() { V8::ClearWeak(reinterpret_cast(this->val_)); @@ -5716,11 +5789,13 @@ void ReturnValue::Set(const Handle handle) { template void ReturnValue::Set(double i) { + TYPE_CHECK(T, Number); Set(Number::New(GetIsolate(), i)); } template void ReturnValue::Set(int32_t i) { + TYPE_CHECK(T, Integer); typedef internal::Internals I; if (V8_LIKELY(I::IsValidSmi(i))) { *value_ = I::IntToSmi(i); @@ -5731,6 +5806,7 @@ void ReturnValue::Set(int32_t i) { template void ReturnValue::Set(uint32_t i) { + TYPE_CHECK(T, Integer); typedef internal::Internals I; // Can't simply use INT32_MAX here for whatever reason. bool fits_into_int32_t = (i & (1 << 31)) == 0; @@ -5743,6 +5819,7 @@ void ReturnValue::Set(uint32_t i) { template void ReturnValue::Set(bool value) { + TYPE_CHECK(T, Boolean); typedef internal::Internals I; int root_index; if (value) { @@ -5755,18 +5832,21 @@ void ReturnValue::Set(bool value) { template void ReturnValue::SetNull() { + TYPE_CHECK(T, Primitive); typedef internal::Internals I; *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex); } template void ReturnValue::SetUndefined() { + TYPE_CHECK(T, Primitive); typedef internal::Internals I; *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex); } template void ReturnValue::SetEmptyString() { + TYPE_CHECK(T, String); typedef internal::Internals I; *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex); } @@ -5936,7 +6016,7 @@ String* String::Cast(v8::Value* value) { Local String::Empty(Isolate* isolate) { typedef internal::Object* S; typedef internal::Internals I; - if (!I::IsInitialized(isolate)) return Empty(); + I::CheckInitialized(isolate); S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); return Local(reinterpret_cast(slot)); } @@ -6160,6 +6240,14 @@ ArrayBuffer* ArrayBuffer::Cast(v8::Value* value) { } +ArrayBufferView* ArrayBufferView::Cast(v8::Value* value) { +#ifdef V8_ENABLE_CHECKS + CheckCast(value); +#endif + return static_cast(value); +} + + TypedArray* TypedArray::Cast(v8::Value* value) { #ifdef V8_ENABLE_CHECKS CheckCast(value); @@ -6240,6 +6328,14 @@ Uint8ClampedArray* Uint8ClampedArray::Cast(v8::Value* value) { } +DataView* DataView::Cast(v8::Value* value) { +#ifdef V8_ENABLE_CHECKS + CheckCast(value); +#endif + return static_cast(value); +} + + Function* Function::Cast(v8::Value* value) { #ifdef V8_ENABLE_CHECKS CheckCast(value); @@ -6289,7 +6385,7 @@ ReturnValue PropertyCallbackInfo::GetReturnValue() const { Handle Undefined(Isolate* isolate) { typedef internal::Object* S; typedef internal::Internals I; - if (!I::IsInitialized(isolate)) return Undefined(); + I::CheckInitialized(isolate); S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex); return Handle(reinterpret_cast(slot)); } @@ -6298,7 +6394,7 @@ Handle Undefined(Isolate* isolate) { Handle Null(Isolate* isolate) { typedef internal::Object* S; typedef internal::Internals I; - if (!I::IsInitialized(isolate)) return Null(); + I::CheckInitialized(isolate); S* slot = I::GetRoot(isolate, I::kNullValueRootIndex); return Handle(reinterpret_cast(slot)); } @@ -6307,7 +6403,7 @@ Handle Null(Isolate* isolate) { Handle True(Isolate* isolate) { typedef internal::Object* S; typedef internal::Internals I; - if (!I::IsInitialized(isolate)) return True(); + I::CheckInitialized(isolate); S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex); return Handle(reinterpret_cast(slot)); } @@ -6316,7 +6412,7 @@ Handle True(Isolate* isolate) { Handle False(Isolate* isolate) { typedef internal::Object* S; typedef internal::Internals I; - if (!I::IsInitialized(isolate)) return False(); + I::CheckInitialized(isolate); S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); return Handle(reinterpret_cast(slot)); } diff --git a/deps/v8/preparser/preparser.gyp b/deps/v8/preparser/preparser.gyp index 863a2ff8a940bf0ca12bc4c33805ea404aaf7f09..598f0a511e1a6509320969c0379b3a5b818b6a80 100644 --- a/deps/v8/preparser/preparser.gyp +++ b/deps/v8/preparser/preparser.gyp @@ -26,6 +26,9 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. { + 'variables': { + 'v8_code': 1, + }, 'includes': ['../build/common.gypi'], 'targets': [ { diff --git a/deps/v8/samples/samples.gyp b/deps/v8/samples/samples.gyp index 3c720a748a19a146fcbae8d05bccdd27bb752b28..8b1de7eb426632966e416781ece2ca651ec9edb4 100644 --- a/deps/v8/samples/samples.gyp +++ b/deps/v8/samples/samples.gyp @@ -26,6 +26,9 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. { + 'variables': { + 'v8_code': 1, + }, 'includes': ['../build/common.gypi'], 'target_defaults': { 'type': 'executable', diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 20496fefde3a050dabd9d8510916da39f1f5e70c..638a25f317cfa779ab4690ed73db14426c20e800 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -38,6 +38,7 @@ #include "compiler.h" #include "conversions-inl.h" #include "counters.h" +#include "cpu-profiler.h" #include "debug.h" #include "deoptimizer.h" #include "execution.h" @@ -183,6 +184,10 @@ void i::V8::FatalProcessOutOfMemory(const char* location, bool take_snapshot) { heap_stats.cell_space_size = &cell_space_size; intptr_t cell_space_capacity; heap_stats.cell_space_capacity = &cell_space_capacity; + intptr_t property_cell_space_size; + heap_stats.property_cell_space_size = &property_cell_space_size; + intptr_t property_cell_space_capacity; + heap_stats.property_cell_space_capacity = &property_cell_space_capacity; intptr_t lo_space_size; heap_stats.lo_space_size = &lo_space_size; int global_handle_count; @@ -296,8 +301,13 @@ static inline bool EmptyCheck(const char* location, const v8::Data* obj) { // --- S t a t i c s --- -static bool InitializeHelper() { - if (i::Snapshot::Initialize()) return true; +static bool InitializeHelper(i::Isolate* isolate) { + // If the isolate has a function entry hook, it needs to re-build all its + // code stubs with entry hooks embedded, so let's deserialize a snapshot. + if (isolate == NULL || isolate->function_entry_hook() == NULL) { + if (i::Snapshot::Initialize()) + return true; + } return i::V8::Initialize(NULL); } @@ -309,7 +319,7 @@ static inline bool EnsureInitializedForIsolate(i::Isolate* isolate, if (isolate->IsInitialized()) return true; } ASSERT(isolate == i::Isolate::Current()); - return ApiCheck(InitializeHelper(), location, "Error initializing V8"); + return ApiCheck(InitializeHelper(isolate), location, "Error initializing V8"); } // Some initializing API functions are called early and may be @@ -385,6 +395,9 @@ enum CompressedStartupDataItems { kSnapshotContext, kLibraries, kExperimentalLibraries, +#if defined(ENABLE_I18N_SUPPORT) + kI18NExtension, +#endif kCompressedStartupDataCount }; @@ -424,6 +437,17 @@ void V8::GetCompressedStartupData(StartupData* compressed_data) { exp_libraries_source.length(); compressed_data[kExperimentalLibraries].raw_size = i::ExperimentalNatives::GetRawScriptsSize(); + +#if defined(ENABLE_I18N_SUPPORT) + i::Vector i18n_extension_source = + i::I18NNatives::GetScriptsSource(); + compressed_data[kI18NExtension].data = + reinterpret_cast(i18n_extension_source.start()); + compressed_data[kI18NExtension].compressed_size = + i18n_extension_source.length(); + compressed_data[kI18NExtension].raw_size = + i::I18NNatives::GetRawScriptsSize(); +#endif #endif } @@ -453,6 +477,15 @@ void V8::SetDecompressedStartupData(StartupData* decompressed_data) { decompressed_data[kExperimentalLibraries].data, decompressed_data[kExperimentalLibraries].raw_size); i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); + +#if defined(ENABLE_I18N_SUPPORT) + ASSERT_EQ(i::I18NNatives::GetRawScriptsSize(), + decompressed_data[kI18NExtension].raw_size); + i::Vector i18n_extension_source( + decompressed_data[kI18NExtension].data, + decompressed_data[kI18NExtension].raw_size); + i::I18NNatives::SetRawScriptsSource(i18n_extension_source); +#endif #endif } @@ -548,8 +581,7 @@ v8::Handle Undefined() { if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) { return v8::Handle(); } - return v8::Handle(ToApi( - isolate->factory()->undefined_value())); + return ToApiHandle(isolate->factory()->undefined_value()); } @@ -558,8 +590,7 @@ v8::Handle Null() { if (!EnsureInitializedForIsolate(isolate, "v8::Null()")) { return v8::Handle(); } - return v8::Handle( - ToApi(isolate->factory()->null_value())); + return ToApiHandle(isolate->factory()->null_value()); } @@ -568,8 +599,7 @@ v8::Handle True() { if (!EnsureInitializedForIsolate(isolate, "v8::True()")) { return v8::Handle(); } - return v8::Handle( - ToApi(isolate->factory()->true_value())); + return ToApiHandle(isolate->factory()->true_value()); } @@ -578,8 +608,7 @@ v8::Handle False() { if (!EnsureInitializedForIsolate(isolate, "v8::False()")) { return v8::Handle(); } - return v8::Handle( - ToApi(isolate->factory()->false_value())); + return ToApiHandle(isolate->factory()->false_value()); } @@ -949,7 +978,7 @@ Local FunctionTemplate::PrototypeTemplate() { result = Utils::OpenHandle(*ObjectTemplate::New()); Utils::OpenHandle(this)->set_prototype_template(*result); } - return Local(ToApi(result)); + return ToApiHandle(result); } @@ -961,6 +990,22 @@ void FunctionTemplate::Inherit(v8::Handle value) { } +// TODO(dcarney): Remove this abstraction when old callbacks are removed. +class CallHandlerHelper { + public: + static inline void Set(Local function_template, + InvocationCallback callback, + v8::Handle data) { + function_template->SetCallHandlerInternal(callback, data); + } + static inline void Set(Local function_template, + FunctionCallback callback, + v8::Handle data) { + function_template->SetCallHandler(callback, data); + } +}; + + template static Local FunctionTemplateNew( Callback callback, @@ -981,7 +1026,7 @@ static Local FunctionTemplateNew( obj->set_serial_number(i::Smi::FromInt(next_serial_number)); if (callback != 0) { if (data.IsEmpty()) data = v8::Undefined(); - Utils::ToLocal(obj)->SetCallHandler(callback, data); + CallHandlerHelper::Set(Utils::ToLocal(obj), callback, data); } obj->set_length(length); obj->set_undetectable(false); @@ -1044,8 +1089,7 @@ template static Local NewDescriptor( Isolate* isolate, const i::DeclaredAccessorDescriptorData& data, - Data* previous_descriptor - ) { + Data* previous_descriptor) { i::Isolate* internal_isolate = reinterpret_cast(isolate); i::Handle previous = i::Handle(); @@ -1055,8 +1099,7 @@ static Local NewDescriptor( } i::Handle descriptor = i::DeclaredAccessorDescriptor::Create(internal_isolate, data, previous); - return Local( - reinterpret_cast(*Utils::ToLocal(descriptor))); + return Utils::Convert(descriptor); } @@ -1227,6 +1270,11 @@ void FunctionTemplate::SetCallHandler(InvocationCallback callback, FunctionTemplateSetCallHandler(this, callback, data); } +void FunctionTemplate::SetCallHandlerInternal(InvocationCallback callback, + v8::Handle data) { + FunctionTemplateSetCallHandler(this, callback, data); +} + void FunctionTemplate::SetCallHandler(FunctionCallback callback, v8::Handle data) { FunctionTemplateSetCallHandler(this, callback, data); @@ -1297,13 +1345,14 @@ Local FunctionTemplate::InstanceTemplate() { || EmptyCheck("v8::FunctionTemplate::InstanceTemplate()", this)) return Local(); ENTER_V8(isolate); - if (Utils::OpenHandle(this)->instance_template()->IsUndefined()) { + i::Handle handle = Utils::OpenHandle(this); + if (handle->instance_template()->IsUndefined()) { Local templ = - ObjectTemplate::New(v8::Handle(this)); - Utils::OpenHandle(this)->set_instance_template(*Utils::OpenHandle(*templ)); + ObjectTemplate::New(ToApiHandle(handle)); + handle->set_instance_template(*Utils::OpenHandle(*templ)); } - i::Handle result(i::ObjectTemplateInfo::cast( - Utils::OpenHandle(this)->instance_template())); + i::Handle result( + i::ObjectTemplateInfo::cast(handle->instance_template())); return Utils::ToLocal(result); } @@ -1901,7 +1950,7 @@ Local + + + +

+ + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + +
+

+ + Instructions + +

+
+
    +
  1. + Run V8 with + --prof --log-timer-events, + or alternatively,
    + Chrome with + + --no-sandbox --js-flags="--prof --noprof-lazy --log-timer-events + to produce v8.log. +
  2. +
  3. + Open + v8.log + on this page. Don't worry, it won't be uploaded anywhere. +
  4. +
  5. + Click "Start" to start number crunching. This will take a while. +
  6. +
  7. + Click "Show plot/profile" to switch between the statistical profile and + the timeline plot.
    + C++ items are missing in the statistical profile because symbol + information is not available.
    + Consider using the + + command-line utility + instead. +
  8. +
+
+ +
+

+ + Credits + +

+
+ +
+
+ +
+ + diff --git a/deps/v8/tools/profviz/profviz.js b/deps/v8/tools/profviz/profviz.js new file mode 100644 index 0000000000000000000000000000000000000000..7af12adc7e9b2e684fcaee55aa7ea29d38b92e74 --- /dev/null +++ b/deps/v8/tools/profviz/profviz.js @@ -0,0 +1,287 @@ +// Copyright 2013 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. + +var worker_scripts = [ + "../csvparser.js", + "../splaytree.js", + "../codemap.js", + "../consarray.js", + "../profile.js", + "../profile_view.js", + "../logreader.js", + "../tickprocessor.js", + "composer.js", + "gnuplot-4.6.3-emscripten.js" +]; + + +function plotWorker() { + var worker = null; + + var delegateList = { + "log" : log, + "error" : logError, + "displayplot" : displayplot, + "displayprof" : displayprof, + "range" : setRange, + "script" : scriptLoaded + } + + function initialize() { + ui.freeze(); + worker = new Worker("worker.js"); + running = false; + + worker.postMessage({ "call" : "load scripts", + "args" : worker_scripts }); + + worker.addEventListener("message", function(event) { + var call = delegateList[event.data["call"]]; + call(event.data["args"]); + }); + } + + function scriptLoaded() { + ui.thaw(); + } + + // Public methods. + this.run = function(filename, + resx, resy, + distortion, + range_start, range_end) { + var args = { + 'file' : filename, + 'resx' : resx, + 'resy' : resy, + 'distortion' : distortion, + 'range_start' : range_start, + 'range_end' : range_end + } + worker.postMessage({ 'call' : 'run', 'args' : args }); + } + + this.reset = function() { + if (worker) worker.terminate(); + initialize(); + } +} + + +function UIWrapper() { + var input_elements = ["range_start", + "range_end", + "distortion", + "start", + "file"]; + + var other_elements = ["log", + "plot", + "prof", + "instructions", + "credits", + "toggledisplay"]; + + for (var i in input_elements) { + var id = input_elements[i]; + this[id] = document.getElementById(id); + } + + for (var i in other_elements) { + var id = other_elements[i]; + this[id] = document.getElementById(id); + } + + this.freeze = function() { + this.plot.style.webkitFilter = "grayscale(1)"; + this.prof.style.color = "#bbb"; + for (var i in input_elements) { + this[input_elements[i]].disabled = true; + } + } + + this.thaw = function() { + this.plot.style.webkitFilter = ""; + this.prof.style.color = "#000"; + for (var i in input_elements) { + this[input_elements[i]].disabled = false; + } + } + + this.reset = function() { + this.thaw(); + this.log.value = ""; + this.range_start.value = "automatic"; + this.range_end.value = "automatic"; + this.toggle("plot"); + this.plot.src = ""; + this.prof.value = ""; + } + + this.toggle = function(mode) { + if (mode) this.toggledisplay.next_mode = mode; + if (this.toggledisplay.next_mode == "plot") { + this.toggledisplay.next_mode = "prof"; + this.plot.style.display = "block"; + this.prof.style.display = "none"; + this.toggledisplay.innerHTML = "Show profile"; + } else { + this.toggledisplay.next_mode = "plot"; + this.plot.style.display = "none"; + this.prof.style.display = "block"; + this.toggledisplay.innerHTML = "Show plot"; + } + } + + this.info = function(field) { + var down_arrow = "\u25bc"; + var right_arrow = "\u25b6"; + if (field && this[field].style.display != "none") field = null; // Toggle. + this.credits.style.display = "none"; + this.instructions.style.display = "none"; + if (!field) return; + this[field].style.display = "block"; + } +} + + +function log(text) { + ui.log.value += text; + ui.log.scrollTop = ui.log.scrollHeight; +} + + +function logError(text) { + if (ui.log.value.length > 0 && + ui.log.value[ui.log.value.length-1] != "\n") { + ui.log.value += "\n"; + } + ui.log.value += "ERROR: " + text + "\n"; + ui.log.scrollTop = ui.log.scrollHeight; + error_logged = true; +} + + +function displayplot(args) { + if (error_logged) { + log("Plot failed.\n\n"); + } else { + log("Displaying plot. Total time: " + + (Date.now() - timer) / 1000 + "ms.\n\n"); + var blob = new Blob([new Uint8Array(args.contents).buffer], + { "type" : "image\/svg+xml" }); + window.URL = window.URL || window.webkitURL; + ui.plot.src = window.URL.createObjectURL(blob); + } + + ui.thaw(); + ui.toggle("plot"); +} + + +function displayprof(args) { + if (error_logged) return; + ui.prof.value = args; + this.prof.style.color = ""; + ui.toggle("prof"); +} + + +function start(event) { + error_logged = false; + ui.freeze(); + + try { + var file = getSelectedFile(); + var distortion = getDistortion(); + var range = getRange(); + } catch (e) { + logError(e.message); + display(); + return; + } + + timer = Date.now(); + worker.run(file, kResX, kResY, distortion, range[0], range[1]); +} + + +function getSelectedFile() { + var file = ui.file.files[0]; + if (!file) throw Error("No valid file selected."); + if (!file.type.toString().match(/text/)) { + throw Error("'" + escape(file.name) + "' is not a text file."); + } + return file; +} + + +function getDistortion() { + var input_distortion = + parseInt(ui.distortion.value, 10); + if (isNaN(input_distortion)) { + input_distortion = ui.distortion.value = 4500; + } + return input_distortion / 1000000; +} + + +function getRange() { + var input_start = + parseInt(ui.range_start.value, 10); + if (isNaN(input_start)) input_start = undefined; + var input_end = + parseInt(ui.range_end.value, 10); + if (isNaN(input_end)) input_end = undefined; + return [input_start, input_end]; +} + + +function setRange(args) { + ui.range_start.value = args.start.toFixed(1); + ui.range_end.value = args.end.toFixed(1); +} + + +function onload() { + kResX = 1200; + kResY = 600; + error_logged = false; + ui = new UIWrapper(); + ui.reset(); + ui.info(null); + worker = new plotWorker(); + worker.reset(); +} + + +var kResX; +var kResY; +var error_logged; +var ui; +var worker; +var timer; diff --git a/deps/v8/tools/profviz/stdio.js b/deps/v8/tools/profviz/stdio.js new file mode 100644 index 0000000000000000000000000000000000000000..e8001494c9df641ffbb0cfce90f618ca729339f0 --- /dev/null +++ b/deps/v8/tools/profviz/stdio.js @@ -0,0 +1,52 @@ +// Copyright 2013 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. + +var processor = new ArgumentsProcessor(arguments); +var distortion_per_entry = 0; +var range_start_override = undefined; +var range_end_override = undefined; + +if (!processor.parse()) processor.printUsageAndExit();; +var result = processor.result(); +var distortion = parseInt(result.distortion); +if (isNaN(distortion)) processor.printUsageAndExit();; +// Convert picoseconds to milliseconds. +distortion_per_entry = distortion / 1000000; +var rangelimits = result.range.split(","); +var range_start = parseInt(rangelimits[0]); +var range_end = parseInt(rangelimits[1]); +if (!isNaN(range_start)) range_start_override = range_start; +if (!isNaN(range_end)) range_end_override = range_end; + +var kResX = 1600; +var kResY = 600; +var psc = new PlotScriptComposer(kResX, kResY); +psc.collectData(readline, distortion_per_entry); +psc.findPlotRange(range_start_override, range_end_override); +print("set terminal pngcairo size " + kResX + "," + kResY + + " enhanced font 'Helvetica,10'"); +psc.assembleOutput(print); diff --git a/deps/v8/tools/profviz/worker.js b/deps/v8/tools/profviz/worker.js new file mode 100644 index 0000000000000000000000000000000000000000..60a557f982d0302e75b21ab73269bc33d43f0dda --- /dev/null +++ b/deps/v8/tools/profviz/worker.js @@ -0,0 +1,167 @@ +// Copyright 2013 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. + +var delegateList = { + "load scripts" : load_scripts, + "run" : run, +} + +self.addEventListener("message", function(event) { + var call = delegateList[event.data["call"]]; + var result = call(event.data["args"]); +}, false); + + +function log(text) { + self.postMessage({ "call" : "log", "args" : text }); +} + + +function displayplot(content) { + self.postMessage({ "call" : "displayplot", "args" : content}); +} + + +function displayprof(content) { + self.postMessage({ "call" : "displayprof", "args" : content}); +} + + +function setRange(start, end) { + self.postMessage({ "call" : "range", + "args" : { "start" : start, "end" : end } }); +} + + +function time(name, fun) { + log(name + "..."); + var start = Date.now(); + fun(); + log(" took " + (Date.now() - start) / 1000 + "s.\n"); +} + + +function load_scripts(scripts) { + time("Loading scripts", + function() { for (var i in scripts) importScripts(scripts[i]); }); + self.postMessage({ "call" : "script" }); +} + + +function run(args) { + var file = args["file"]; + var resx = args["resx"]; + var resy = args["resy"]; + var distortion = args["distortion"]; + var range_start_override = args["range_start"]; + var range_end_override = args["range_end"]; + + var reader = new FileReaderSync(); + var content_lines; + + time("Reading log file (" + (file.size / 1024).toFixed(1) + " kB)", + function() { + var content = reader.readAsText(file); + content_lines = content.split("\n"); + }); + + time("Producing statistical profile", + function() { + var profile = ""; + print = function(text) { profile += text + "\n"; }; + // Dummy entries provider, as we cannot call nm. + var entriesProvider = new UnixCppEntriesProvider("", ""); + var targetRootFS = ""; + var separateIc = false; + var callGraphSize = 5; + var ignoreUnknown = true; + var stateFilter = null; + var snapshotLogProcessor = null; + var range = range_start_override + "," + range_end_override; + + var tickProcessor = new TickProcessor(entriesProvider, + separateIc, + callGraphSize, + ignoreUnknown, + stateFilter, + snapshotLogProcessor, + distortion, + range); + for (var i = 0; i < content_lines.length; i++) { + tickProcessor.processLogLine(content_lines[i]); + } + tickProcessor.printStatistics(); + displayprof(profile); + }); + + var input_file_name = "input_temp"; + var output_file_name = "output.svg"; + + var psc = new PlotScriptComposer(resx, resy); + var objects = 0; + + time("Collecting events (" + content_lines.length + " entries)", + function() { + var line_cursor = 0; + var input = function() { return content_lines[line_cursor++]; }; + psc.collectData(input, distortion); + psc.findPlotRange(range_start_override, + range_end_override, + setRange); + }); + + time("Assembling plot script", + function() { + var plot_script = ""; + var output = function(text) { plot_script += text + "\n"; }; + output("set terminal svg size " + resx + "," + resy + + " enhanced font \"Helvetica,10\""); + output("set output \""+ output_file_name + "\""); + objects = psc.assembleOutput(output); + if (FS.findObject(input_file_name)) { + FS.deleteFile(input_file_name); + } + var arrc = Module["intArrayFromString"](plot_script, true); + FS.createDataFile("/", input_file_name, arrc); + }); + + time("Running gnuplot (" + objects + " objects)", + function() { Module.run([input_file_name]); }); + + displayplot(FS.findObject(output_file_name)); +} + + +var Module = { + "noInitialRun": true, + print: function(text) { + self.postMessage({"call": "error", "args": text}); + }, + printErr: function(text) { + self.postMessage({"call": "error", "args": text}); + }, +}; diff --git a/deps/v8/tools/testrunner/local/execution.py b/deps/v8/tools/testrunner/local/execution.py index 0f52616d97fcc574caeeadf07c5a111684e324fc..4453c08451f48cffd3891b4a62c7078e7d3972da 100644 --- a/deps/v8/tools/testrunner/local/execution.py +++ b/deps/v8/tools/testrunner/local/execution.py @@ -138,14 +138,15 @@ class Runner(object): self.indicator.AboutToRun(test) test.output = result[1] test.duration = result[2] - if test.suite.HasUnexpectedOutput(test): + has_unexpected_output = test.suite.HasUnexpectedOutput(test) + if has_unexpected_output: self.failed.append(test) if test.output.HasCrashed(): self.crashed += 1 else: self.succeeded += 1 self.remaining -= 1 - self.indicator.HasRun(test) + self.indicator.HasRun(test, has_unexpected_output) except KeyboardInterrupt: pool.terminate() pool.join() diff --git a/deps/v8/tools/testrunner/local/old_statusfile.py b/deps/v8/tools/testrunner/local/old_statusfile.py index a16941b83b9bcbfec90817d40e91d1979b6c9aa7..a9a62036ec48fcfcd68135e8c93358a163122a6c 100644 --- a/deps/v8/tools/testrunner/local/old_statusfile.py +++ b/deps/v8/tools/testrunner/local/old_statusfile.py @@ -386,7 +386,7 @@ class ConvertNotation(object): self.init = True def CloseGlobal(self): - if not self.init: return + if not self.init: self.OpenGlobal() print >> self.out, "]" self.init = False diff --git a/deps/v8/tools/testrunner/local/progress.py b/deps/v8/tools/testrunner/local/progress.py index c13c0eb54e3c36e9753ee01bdf9373b74abf7262..a663be23eba8714fea65d1a30e71ecdeebcf759b 100644 --- a/deps/v8/tools/testrunner/local/progress.py +++ b/deps/v8/tools/testrunner/local/progress.py @@ -57,7 +57,7 @@ class ProgressIndicator(object): def AboutToRun(self, test): pass - def HasRun(self, test): + def HasRun(self, test, has_unexpected_output): pass def PrintFailureHeader(self, test): @@ -111,8 +111,8 @@ class VerboseProgressIndicator(SimpleProgressIndicator): print 'Starting %s...' % test.GetLabel() sys.stdout.flush() - def HasRun(self, test): - if test.suite.HasUnexpectedOutput(test): + def HasRun(self, test, has_unexpected_output): + if has_unexpected_output: if test.output.HasCrashed(): outcome = 'CRASH' else: @@ -124,11 +124,11 @@ class VerboseProgressIndicator(SimpleProgressIndicator): class DotsProgressIndicator(SimpleProgressIndicator): - def HasRun(self, test): + def HasRun(self, test, has_unexpected_output): total = self.runner.succeeded + len(self.runner.failed) if (total > 1) and (total % 50 == 1): sys.stdout.write('\n') - if test.suite.HasUnexpectedOutput(test): + if has_unexpected_output: if test.output.HasCrashed(): sys.stdout.write('C') sys.stdout.flush() @@ -159,8 +159,8 @@ class CompactProgressIndicator(ProgressIndicator): def AboutToRun(self, test): self.PrintProgress(test.GetLabel()) - def HasRun(self, test): - if test.suite.HasUnexpectedOutput(test): + def HasRun(self, test, has_unexpected_output): + if has_unexpected_output: self.ClearLine(self.last_status_length) self.PrintFailureHeader(test) stdout = test.output.stdout.strip() @@ -255,10 +255,10 @@ class JUnitTestProgressIndicator(ProgressIndicator): def AboutToRun(self, test): self.progress_indicator.AboutToRun(test) - def HasRun(self, test): - self.progress_indicator.HasRun(test) + def HasRun(self, test, has_unexpected_output): + self.progress_indicator.HasRun(test, has_unexpected_output) fail_text = "" - if test.suite.HasUnexpectedOutput(test): + if has_unexpected_output: stdout = test.output.stdout.strip() if len(stdout): fail_text += "stdout:\n%s\n" % stdout diff --git a/deps/v8/tools/testrunner/network/endpoint.py b/deps/v8/tools/testrunner/network/endpoint.py index 5dc2b9f902450aab5ae996093511ff97ba76694f..d0950cf5a6b669a91c4d3870dc7f7b2059970a25 100644 --- a/deps/v8/tools/testrunner/network/endpoint.py +++ b/deps/v8/tools/testrunner/network/endpoint.py @@ -50,7 +50,7 @@ class EndpointProgress(progress.ProgressIndicator): self.senderthread = threading.Thread(target=self._SenderThread) self.senderthread.start() - def HasRun(self, test): + def HasRun(self, test, has_unexpected_output): # The runners that call this have a lock anyway, so this is safe. self.results_queue.append(test) @@ -119,6 +119,6 @@ def Execute(workspace, ctx, tests, sock, server): else: message = "%s" % e compression.Send([[-1, message]], sock) - progress_indicator.HasRun(None) # Sentinel to signal the end. + progress_indicator.HasRun(None, None) # Sentinel to signal the end. progress_indicator.sender_lock.acquire() # Released when sending is done. progress_indicator.sender_lock.release() diff --git a/deps/v8/tools/testrunner/network/network_execution.py b/deps/v8/tools/testrunner/network/network_execution.py index ddb59e60b787426cd081d5a46f4380e36eb384f2..0f53a6bb645bf2a757948e7656e6817a124349e8 100644 --- a/deps/v8/tools/testrunner/network/network_execution.py +++ b/deps/v8/tools/testrunner/network/network_execution.py @@ -204,14 +204,15 @@ class NetworkedRunner(execution.Runner): self.context.arch, self.context.mode], self.local_socket) self.indicator.AboutToRun(test) - if test.suite.HasUnexpectedOutput(test): + has_unexpected_output = test.suite.HasUnexpectedOutput(test) + if has_unexpected_output: self.failed.append(test) if test.output.HasCrashed(): self.crashed += 1 else: self.succeeded += 1 self.remaining -= 1 - self.indicator.HasRun(test) + self.indicator.HasRun(test, has_unexpected_output) rec.Advance() peer.runtime = time.time() - start_time except KeyboardInterrupt: diff --git a/deps/v8/tools/tickprocessor.js b/deps/v8/tools/tickprocessor.js index abb2f2d7ee7efabbf39d164701306c7b9d6d409a..967bd3c5b71f49031846569bcd279181aa1619ec 100644 --- a/deps/v8/tools/tickprocessor.js +++ b/deps/v8/tools/tickprocessor.js @@ -169,7 +169,7 @@ function TickProcessor( 'snapshot-pos': { parsers: [parseInt, parseInt], processor: this.processSnapshotPosition }, 'tick': { - parsers: [parseInt, parseInt, parseInt, parseInt, + parsers: [parseInt, parseInt, parseInt, parseInt, parseInt, 'var-args'], processor: this.processTick }, 'heap-sample-begin': { parsers: [null, null, parseInt], @@ -204,7 +204,7 @@ function TickProcessor( // Convert picoseconds to nanoseconds. this.distortion_per_entry = isNaN(distortion) ? 0 : (distortion / 1000); this.distortion = 0; - var rangelimits = range.split(","); + var rangelimits = range ? range.split(",") : []; var range_start = parseInt(rangelimits[0]); var range_end = parseInt(rangelimits[1]); // Convert milliseconds to nanoseconds. @@ -365,7 +365,6 @@ TickProcessor.prototype.includeTick = function(vmState) { }; TickProcessor.prototype.processTick = function(pc, - sp, ns_since_start, is_external_callback, tos_or_external_callback, diff --git a/deps/v8/tools/v8-info.sh b/deps/v8/tools/v8-info.sh new file mode 100755 index 0000000000000000000000000000000000000000..1f25d147a571ebe8d4c435f6507441c15437cd3c --- /dev/null +++ b/deps/v8/tools/v8-info.sh @@ -0,0 +1,161 @@ +#!/bin/bash +# Copyright 2013 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. + + +########## Global variable definitions + +BASE_URL="https://code.google.com/p/v8/source/list" +VERSION="src/version.cc" +MAJOR="MAJOR_VERSION" +MINOR="MINOR_VERSION" +BUILD="BUILD_NUMBER" +PATCH="PATCH_LEVEL" + +V8="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +########## Function definitions + +cd $V8 + +usage() { +cat << EOF +usage: $0 OPTIONS + +Fetches V8 revision information from a git-svn checkout. + +OPTIONS: + -h Show this message. + + -i Print revision info for all branches matching the V8 version. + Example usage: $0 -i 3.19.10$ + Output format: [Git hash] [SVN revision] [V8 version] + + -v Print the V8 version tag for a trunk SVN revision. + Example usage: $0 -v 14981 + Output format: [V8 version] + + -m Print all patches that were merged to the specified V8 branch. + Example usage: $0 -m 3.18 + Output format: [V8 version] [SVN revision] [SVN patch merged]*. + + -p Print all patches merged to a specific V8 point-release. + Example usage: $0 -p 3.19.12.1 + Output format: [SVN patch merged]* + + -u Print a link to all SVN revisions between two V8 revision tags. + Example usage: $0 -u 3.19.10:3.19.11 +EOF +} + +tags() { + git for-each-ref --format="%(objectname) %(refname:short)" refs/remotes/svn +} + +tag_revision() { + cut -d" " -f1 +} + +tag_log() { + git log --format="%h %ci %ce %s" -1 $1 +} + +v8_hash() { + tags | grep "svn/tags/$1$" | tag_revision +} + +point_merges() { + echo $1 | grep -o "r[0-9]\+" +} + +hash_to_svn() { + git svn log -1 --oneline $1 | cut -d" " -f1 +} + +tag_version() { + tags | grep svn/tags/$1 | while read tag; do + id=$(echo $tag | grep -o "[^/]*$") + rev=$(echo $tag | tag_revision) + svn=$(hash_to_svn $rev) + echo $rev $svn $id + done +} + +svn_rev() { + git svn find-rev $2 svn/$1 +} + +v8_rev() { + cd $(git rev-parse --show-toplevel) + rev=$(git show $1:$VERSION \ + | grep "#define" \ + | grep "$MAJOR\|$MINOR\|$BUILD\|$PATCH" \ + | grep -o "[0-9]\+$" \ + | tr "\\n" ".") + echo ${rev%?} +} + +merges_to_branch() { + git cherry -v svn/trunk svn/$1 | while read merge; do + h=$(echo $merge | cut -d" " -f2) + svn=$(svn_rev $1 $h) + merges=$(echo $merge | grep -o "r[0-9]\+") + rev=$(v8_rev $h) + echo $rev r$svn $merges + done +} + +url_for() { + first=$(svn_rev trunk $(v8_hash $(echo $1 | cut -d":" -f1))) + last=$(svn_rev trunk $(v8_hash $(echo $1 | cut -d":" -f2))) + num=$[ $last - $first] + echo "$BASE_URL?num=$num&start=$last" +} + +########## Option parsing + +while getopts ":hi:v:m:p:u:" OPTION ; do + case $OPTION in + h) usage + exit 0 + ;; + i) tag_version $OPTARG + ;; + v) v8_rev $(svn_rev trunk r$OPTARG) + ;; + m) merges_to_branch $OPTARG + ;; + p) echo $(point_merges "$(tag_log $(v8_hash $OPTARG)^1)") + ;; + u) url_for $OPTARG + ;; + ?) echo "Illegal option: -$OPTARG" + usage + exit 1 + ;; + esac +done diff --git a/deps/v8/tools/v8-rolls.sh b/deps/v8/tools/v8-rolls.sh new file mode 100755 index 0000000000000000000000000000000000000000..590e05c1f9cd81498589c8770794bc1dc575bb9e --- /dev/null +++ b/deps/v8/tools/v8-rolls.sh @@ -0,0 +1,120 @@ +#!/bin/bash +# Copyright 2013 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. + + +########## Global variable definitions + +DEPS_STRING='"v8_revision":' +INFO=tools/v8-info.sh + +V8="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +########## Function definitions + +usage() { +cat << EOF +usage: $0 OPTIONS + +Run in chromium/src to get information about V8 rolls. + +OPTIONS: + -h Show this message. + -n Number of rolls to print information about. + -s Chromium git hash to start printing V8 information about. +EOF +} + +v8_line() { + git show $1:DEPS | grep -n $DEPS_STRING | cut -d":" -f1 +} + +v8_info() { + git blame -L$(v8_line $1),+1 $1 DEPS | grep $DEPS_STRING +} + +v8_svn() { + sed -e 's/^.*"\([0-9]\+\)",$/\1/' +} + +v8_roll() { + cut -d" " -f1 +} + +find_rev() { + git svn find-rev $1 +} + +msg() { + msg=$(git log --format="%h %ci %ce" -1 $1) + h=$(echo $msg | cut -d" " -f1) + d=$(echo $msg | cut -d" " -f2) + t=$(echo $msg | cut -d" " -f3) + a=$(echo $msg | cut -d" " -f5) + a1=$(echo $a | cut -d"@" -f1) + a2=$(echo $a | cut -d"@" -f2) + echo $h $d $t $a1@$a2 +} + +v8_revision() { + cd $V8 + $INFO -v $1 +} + +rolls() { + roll=$2 + for i in $(seq 1 $1); do + info=$(v8_info $roll) + roll=$(echo $info | v8_roll $roll) + trunk=$(echo $info | v8_svn $roll) + echo "$(v8_revision $trunk) $trunk $(find_rev $roll) $(msg $roll)" + roll=$roll^1 + done +} + +########## Option parsing + +REVISIONS=1 +START=HEAD + +while getopts ":hn:s:" OPTION ; do + case $OPTION in + h) usage + exit 0 + ;; + n) REVISIONS=$OPTARG + ;; + s) START=$OPTARG + ;; + ?) echo "Illegal option: -$OPTARG" + usage + exit 1 + ;; + esac +done + +rolls $REVISIONS $START