From 4bbab1434635ada79b5a82a06872a15870213a52 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 13 Aug 2010 07:43:53 -0700 Subject: [PATCH] Revert "Upgrade V8 to 2.3.7" This reverts commit 083ee0f8b7a8d98d51bf2debf47d68117f13087f. V8 build broken on cygwin: ./deps/v8/src/handles.h:62: instantiated from `T* v8::internal::Handle::operator->() const [with T = v8::internal::Code]' ./deps/v8/src/accessors.cc:396: instantiated from here ./deps/v8/src/handles-inl.h:50: error: call of overloaded `BitCast(v8::internal::Code** const&)' is ambiguous ./deps/v8/src/utils.h:732: note: candidates are: Dest v8::internal::BitCast(const Source&) [with Dest = v8::internal::Code**, Source = v8::internal::Code**] ./deps/v8/src/utils.h:743: note: Dest v8::internal::BitCast(Source* const&) [with Dest = v8::internal::Code**, Source = v8::internal::Code*] scons: *** [obj/release/accessors.o] Error 1 --- deps/v8/AUTHORS | 1 - deps/v8/ChangeLog | 30 +- deps/v8/SConstruct | 3 +- deps/v8/include/v8-profiler.h | 30 +- deps/v8/include/v8.h | 54 +- deps/v8/src/accessors.cc | 2 +- deps/v8/src/api.cc | 139 +- deps/v8/src/arm/builtins-arm.cc | 2 +- deps/v8/src/arm/codegen-arm.cc | 186 ++- deps/v8/src/arm/macro-assembler-arm.cc | 5 +- deps/v8/src/bootstrapper.cc | 5 +- deps/v8/src/checks.h | 10 +- deps/v8/src/codegen.cc | 15 +- deps/v8/src/codegen.h | 9 - deps/v8/src/cpu-profiler.cc | 11 +- deps/v8/src/cpu-profiler.h | 2 +- deps/v8/src/debug.cc | 4 +- deps/v8/src/factory.cc | 10 +- deps/v8/src/factory.h | 4 +- deps/v8/src/handles-inl.h | 2 +- deps/v8/src/handles.cc | 26 +- deps/v8/src/heap-profiler.cc | 6 +- deps/v8/src/heap.cc | 68 +- deps/v8/src/ia32/assembler-ia32.cc | 15 - deps/v8/src/ia32/assembler-ia32.h | 1 - deps/v8/src/ia32/builtins-ia32.cc | 2 +- deps/v8/src/ia32/codegen-ia32.cc | 410 ++---- deps/v8/src/ia32/codegen-ia32.h | 11 +- deps/v8/src/ia32/macro-assembler-ia32.cc | 66 +- deps/v8/src/ia32/macro-assembler-ia32.h | 33 - deps/v8/src/ia32/virtual-frame-ia32.h | 16 - deps/v8/src/list-inl.h | 7 - deps/v8/src/list.h | 2 - deps/v8/src/mips/simulator-mips.cc | 7 +- deps/v8/src/objects-inl.h | 8 +- deps/v8/src/objects.cc | 16 +- deps/v8/src/objects.h | 4 +- deps/v8/src/parser.cc | 9 +- deps/v8/src/profile-generator-inl.h | 18 + deps/v8/src/profile-generator.cc | 1234 ++++++----------- deps/v8/src/profile-generator.h | 491 +++---- deps/v8/src/runtime.cc | 16 +- deps/v8/src/serialize.h | 2 +- deps/v8/src/top.cc | 9 +- deps/v8/src/utils.h | 6 +- deps/v8/src/version.cc | 4 +- deps/v8/src/x64/assembler-x64.cc | 2 +- deps/v8/src/x64/builtins-x64.cc | 2 +- deps/v8/src/x64/codegen-x64.cc | 9 +- deps/v8/src/x64/macro-assembler-x64.cc | 5 +- deps/v8/test/cctest/test-api.cc | 6 +- deps/v8/test/cctest/test-cpu-profiler.cc | 15 - deps/v8/test/cctest/test-heap-profiler.cc | 224 +-- .../api-call-after-bypassed-exception.js | 52 +- .../mjsunit/debug-clearbreakpointgroup.js | 234 ++-- .../debug-evaluate-bool-constructor.js | 160 +-- deps/v8/test/mjsunit/debug-references.js | 236 ++-- deps/v8/test/mjsunit/debug-stepin-accessor.js | 496 +++---- deps/v8/test/mjsunit/debug-stepin-builtin.js | 156 +-- .../debug-stepin-call-function-stub.js | 230 +-- .../mjsunit/debug-stepin-function-call.js | 296 ++-- .../test/mjsunit/debug-stepnext-do-while.js | 158 +-- .../debug-stepout-recursive-function.js | 212 +-- .../test/mjsunit/debug-stepout-to-builtin.js | 168 +-- .../mjsunit/global-deleted-property-keyed.js | 76 +- deps/v8/test/mjsunit/object-literal.js | 32 +- deps/v8/test/mjsunit/regexp-capture.js | 114 +- .../mjsunit/regress/bitops-register-alias.js | 31 - deps/v8/test/mjsunit/regress/regress-246.js | 60 +- deps/v8/test/sputnik/sputnik.status | 4 +- deps/v8/tools/gyp/v8.gyp | 2 + 71 files changed, 2463 insertions(+), 3528 deletions(-) delete mode 100644 deps/v8/test/mjsunit/regress/bitops-register-alias.js diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 65b8965f1a..4d87db3be0 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -29,5 +29,4 @@ Rodolph Perfetta Ryan Dahl Subrato K De Burcu Dogan -Vlad Burlik diff --git a/deps/v8/ChangeLog b/deps/v8/ChangeLog index caa63feba1..b5663744d3 100644 --- a/deps/v8/ChangeLog +++ b/deps/v8/ChangeLog @@ -1,33 +1,11 @@ -2010-08-11: Version 2.3.7 - - Reduced size of heap snapshots produced by heap profiler (issue 783). - - Introduced v8::Value::IsRegExp method. - - Fixed CPU profiler crash in start / stop sequence when non-existent - name is passed (issue http://crbug.com/51594). - - Introduced new indexed property query callbacks API (issue 816). This - API is guarded by USE_NEW_QUERY_CALLBACK define and is disabled - by default. - - Removed support for object literal get/set with number/string - property name. - - Fixed handling of JSObject::elements in CalculateNetworkSize - (issue 822). - - Allow compiling with strict aliasing enabled on GCC 4.4 (issue 463). - - 2010-08-09: Version 2.3.6 - RegExp literals create a new object every time they are evaluated - (issue 704). + RegExp literals create a new object every time they are evaluated + (issue 704). - Object.seal and Object.freeze return the modified object (issue 809). + Object.seal and Object.freeze return the modified object (issue 809). - Fix building using GCC 4.4.4. + Fix building using GCC 4.4.4. 2010-08-04: Version 2.3.5 diff --git a/deps/v8/SConstruct b/deps/v8/SConstruct index 8fc192637c..00b8fb7219 100644 --- a/deps/v8/SConstruct +++ b/deps/v8/SConstruct @@ -58,7 +58,7 @@ else: # on linux we need these compiler flags to avoid crashes in the v8 test suite # and avoid dtoa.c strict aliasing issues if os.environ.get('GCC_VERSION') == '44': - GCC_EXTRA_CCFLAGS = ['-fno-tree-vrp'] + GCC_EXTRA_CCFLAGS = ['-fno-tree-vrp', '-fno-strict-aliasing'] GCC_DTOA_EXTRA_CCFLAGS = [] else: GCC_EXTRA_CCFLAGS = [] @@ -80,6 +80,7 @@ ANDROID_FLAGS = ['-march=armv7-a', '-frerun-cse-after-loop', '-frename-registers', '-fomit-frame-pointer', + '-fno-strict-aliasing', '-finline-limit=64', '-DCAN_USE_VFP_INSTRUCTIONS=1', '-DCAN_USE_ARMV7_INSTRUCTIONS=1', diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index 9e3cb873c6..c99eb0d9f8 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -194,10 +194,10 @@ class HeapGraphNode; class V8EXPORT HeapGraphEdge { public: enum Type { - kContextVariable = 0, // A variable from a function context. - kElement = 1, // An element of an array. - kProperty = 2, // A named object property. - kInternal = 3 // A link that can't be accessed from JS, + CONTEXT_VARIABLE = 0, // A variable from a function context. + ELEMENT = 1, // An element of an array. + PROPERTY = 2, // A named object property. + INTERNAL = 3 // A link that can't be accessed from JS, // thus, its name isn't a real property name. }; @@ -240,12 +240,12 @@ class V8EXPORT HeapGraphPath { class V8EXPORT HeapGraphNode { public: enum Type { - kInternal = 0, // Internal node, a virtual one, for housekeeping. - kArray = 1, // An array of elements. - kString = 2, // A string. - kObject = 3, // A JS object (except for arrays and strings). - kCode = 4, // Compiled code. - kClosure = 5 // Function closure. + INTERNAL = 0, // Internal node, a virtual one, for housekeeping. + ARRAY = 1, // An array of elements. + STRING = 2, // A string. + OBJECT = 3, // A JS object (except for arrays and strings). + CODE = 4, // Compiled code. + CLOSURE = 5 // Function closure. }; /** Returns node type (see HeapGraphNode::Type). */ @@ -268,15 +268,13 @@ class V8EXPORT HeapGraphNode { int GetSelfSize() const; /** Returns node's network (self + reachable nodes) size, in bytes. */ - int GetReachableSize() const; + int GetTotalSize() const; /** - * Returns node's retained size, in bytes. That is, self + sizes of - * the objects that are reachable only from this object. In other - * words, the size of memory that will be reclaimed having this node - * collected. + * Returns node's private size, in bytes. That is, the size of memory + * that will be reclaimed having this node collected. */ - int GetRetainedSize() const; + int GetPrivateSize() const; /** Returns child nodes count of the node. */ int GetChildrenCount() const; diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 20cef79a7f..3ac10ab917 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -919,11 +919,6 @@ class Value : public Data { */ V8EXPORT bool IsDate() const; - /** - * Returns true if this value is a RegExp. - */ - V8EXPORT bool IsRegExp() const; - V8EXPORT Local ToBoolean() const; V8EXPORT Local ToNumber() const; V8EXPORT Local ToString() const; @@ -1824,19 +1819,10 @@ typedef Handle (*IndexedPropertySetter)(uint32_t index, /** * Returns a non-empty handle if the interceptor intercepts the request. - * The result is true if either a boolean (true if property exists and false - * otherwise) or an integer encoding property attributes. + * The result is true if the property exists and false otherwise. */ -#ifdef USE_NEW_QUERY_CALLBACKS -typedef Handle (*IndexedPropertyQuery)(uint32_t index, - const AccessorInfo& info); -#else typedef Handle (*IndexedPropertyQuery)(uint32_t index, const AccessorInfo& info); -#endif - -typedef Handle (*IndexedPropertyQueryImpl)(uint32_t index, - const AccessorInfo& info); /** * Returns a non-empty handle if the deleter intercepts the request. @@ -2054,23 +2040,7 @@ class V8EXPORT FunctionTemplate : public Template { IndexedPropertyQuery query, IndexedPropertyDeleter remover, IndexedPropertyEnumerator enumerator, - Handle data) { - IndexedPropertyQueryImpl casted = - reinterpret_cast(query); - SetIndexedInstancePropertyHandlerImpl(getter, - setter, - casted, - remover, - enumerator, - data); - } - void SetIndexedInstancePropertyHandlerImpl( - IndexedPropertyGetter getter, - IndexedPropertySetter setter, - IndexedPropertyQueryImpl query, - IndexedPropertyDeleter remover, - IndexedPropertyEnumerator enumerator, - Handle data); + Handle data); void SetInstanceCallAsFunctionHandler(InvocationCallback callback, Handle data); @@ -2169,25 +2139,7 @@ class V8EXPORT ObjectTemplate : public Template { IndexedPropertyQuery query = 0, IndexedPropertyDeleter deleter = 0, IndexedPropertyEnumerator enumerator = 0, - Handle data = Handle()) { - IndexedPropertyQueryImpl casted = - reinterpret_cast(query); - SetIndexedPropertyHandlerImpl(getter, - setter, - casted, - deleter, - enumerator, - data); - } - private: - void SetIndexedPropertyHandlerImpl(IndexedPropertyGetter getter, - IndexedPropertySetter setter, - IndexedPropertyQueryImpl query, - IndexedPropertyDeleter deleter, - IndexedPropertyEnumerator enumerator, - Handle data); - public: - + Handle data = Handle()); /** * Sets the callback to be used when calling instances created from * this template as a function. If no callback is set, instances diff --git a/deps/v8/src/accessors.cc b/deps/v8/src/accessors.cc index 3c49846601..ed0bbd7a1c 100644 --- a/deps/v8/src/accessors.cc +++ b/deps/v8/src/accessors.cc @@ -488,7 +488,7 @@ Object* Accessors::FunctionGetLength(Object* object, void*) { JSFunction* function = FindInPrototypeChain(object, &found_it); if (!found_it) return Smi::FromInt(0); // Check if already compiled. - if (!function->shared()->is_compiled()) { + if (!function->is_compiled()) { // If the function isn't compiled yet, the length is not computed // correctly yet. Compile it now and return the right length. HandleScope scope; diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index b3164dd01e..4fdc95f5ee 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -886,10 +886,10 @@ void FunctionTemplate::SetNamedInstancePropertyHandler( } -void FunctionTemplate::SetIndexedInstancePropertyHandlerImpl( +void FunctionTemplate::SetIndexedInstancePropertyHandler( IndexedPropertyGetter getter, IndexedPropertySetter setter, - IndexedPropertyQueryImpl query, + IndexedPropertyQuery query, IndexedPropertyDeleter remover, IndexedPropertyEnumerator enumerator, Handle data) { @@ -1054,10 +1054,10 @@ void ObjectTemplate::SetAccessCheckCallbacks( } -void ObjectTemplate::SetIndexedPropertyHandlerImpl( +void ObjectTemplate::SetIndexedPropertyHandler( IndexedPropertyGetter getter, IndexedPropertySetter setter, - IndexedPropertyQueryImpl query, + IndexedPropertyQuery query, IndexedPropertyDeleter remover, IndexedPropertyEnumerator enumerator, Handle data) { @@ -1068,12 +1068,12 @@ void ObjectTemplate::SetIndexedPropertyHandlerImpl( i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast(Utils::OpenHandle(this)->constructor()); i::Handle cons(constructor); - Utils::ToLocal(cons)->SetIndexedInstancePropertyHandlerImpl(getter, - setter, - query, - remover, - enumerator, - data); + Utils::ToLocal(cons)->SetIndexedInstancePropertyHandler(getter, + setter, + query, + remover, + enumerator, + data); } @@ -1792,13 +1792,6 @@ bool Value::IsDate() const { } -bool Value::IsRegExp() const { - if (IsDeadCheck("v8::Value::IsRegExp()")) return false; - i::Handle obj = Utils::OpenHandle(this); - return obj->IsJSRegExp(); -} - - Local Value::ToString() const { if (IsDeadCheck("v8::Value::ToString()")) return Local(); LOG_API("ToString"); @@ -4498,27 +4491,24 @@ const CpuProfile* CpuProfiler::StopProfiling(Handle title, } -static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { - return const_cast( - reinterpret_cast(edge)); -} - HeapGraphEdge::Type HeapGraphEdge::GetType() const { IsDeadCheck("v8::HeapGraphEdge::GetType"); - return static_cast(ToInternal(this)->type()); + return static_cast( + reinterpret_cast(this)->type()); } Handle HeapGraphEdge::GetName() const { IsDeadCheck("v8::HeapGraphEdge::GetName"); - i::HeapGraphEdge* edge = ToInternal(this); + const i::HeapGraphEdge* edge = + reinterpret_cast(this); switch (edge->type()) { - case i::HeapGraphEdge::kContextVariable: - case i::HeapGraphEdge::kInternal: - case i::HeapGraphEdge::kProperty: + case i::HeapGraphEdge::CONTEXT_VARIABLE: + case i::HeapGraphEdge::INTERNAL: + case i::HeapGraphEdge::PROPERTY: return Handle(ToApi(i::Factory::LookupAsciiSymbol( edge->name()))); - case i::HeapGraphEdge::kElement: + case i::HeapGraphEdge::ELEMENT: return Handle(ToApi(i::Factory::NewNumberFromInt( edge->index()))); default: UNREACHABLE(); @@ -4529,32 +4519,28 @@ Handle HeapGraphEdge::GetName() const { const HeapGraphNode* HeapGraphEdge::GetFromNode() const { IsDeadCheck("v8::HeapGraphEdge::GetFromNode"); - const i::HeapEntry* from = ToInternal(this)->From(); + const i::HeapEntry* from = + reinterpret_cast(this)->from(); return reinterpret_cast(from); } const HeapGraphNode* HeapGraphEdge::GetToNode() const { IsDeadCheck("v8::HeapGraphEdge::GetToNode"); - const i::HeapEntry* to = ToInternal(this)->to(); + const i::HeapEntry* to = + reinterpret_cast(this)->to(); return reinterpret_cast(to); } -static i::HeapGraphPath* ToInternal(const HeapGraphPath* path) { - return const_cast( - reinterpret_cast(path)); -} - - int HeapGraphPath::GetEdgesCount() const { - return ToInternal(this)->path()->length(); + return reinterpret_cast(this)->path()->length(); } const HeapGraphEdge* HeapGraphPath::GetEdge(int index) const { return reinterpret_cast( - ToInternal(this)->path()->at(index)); + reinterpret_cast(this)->path()->at(index)); } @@ -4569,136 +4555,137 @@ const HeapGraphNode* HeapGraphPath::GetToNode() const { } -static i::HeapEntry* ToInternal(const HeapGraphNode* entry) { - return const_cast( - reinterpret_cast(entry)); -} - - HeapGraphNode::Type HeapGraphNode::GetType() const { IsDeadCheck("v8::HeapGraphNode::GetType"); - return static_cast(ToInternal(this)->type()); + return static_cast( + reinterpret_cast(this)->type()); } Handle HeapGraphNode::GetName() const { IsDeadCheck("v8::HeapGraphNode::GetName"); return Handle(ToApi(i::Factory::LookupAsciiSymbol( - ToInternal(this)->name()))); + reinterpret_cast(this)->name()))); } uint64_t HeapGraphNode::GetId() const { IsDeadCheck("v8::HeapGraphNode::GetId"); - return ToInternal(this)->id(); + return reinterpret_cast(this)->id(); } int HeapGraphNode::GetSelfSize() const { IsDeadCheck("v8::HeapGraphNode::GetSelfSize"); - return ToInternal(this)->self_size(); + return reinterpret_cast(this)->self_size(); } -int HeapGraphNode::GetReachableSize() const { - IsDeadCheck("v8::HeapSnapshot::GetReachableSize"); - return ToInternal(this)->ReachableSize(); +int HeapGraphNode::GetTotalSize() const { + IsDeadCheck("v8::HeapSnapshot::GetHead"); + return const_cast( + reinterpret_cast(this))->TotalSize(); } -int HeapGraphNode::GetRetainedSize() const { - IsDeadCheck("v8::HeapSnapshot::GetRetainedSize"); - return ToInternal(this)->RetainedSize(); +int HeapGraphNode::GetPrivateSize() const { + IsDeadCheck("v8::HeapSnapshot::GetPrivateSize"); + return const_cast( + reinterpret_cast(this))->NonSharedTotalSize(); } int HeapGraphNode::GetChildrenCount() const { IsDeadCheck("v8::HeapSnapshot::GetChildrenCount"); - return ToInternal(this)->children().length(); + return reinterpret_cast(this)->children()->length(); } const HeapGraphEdge* HeapGraphNode::GetChild(int index) const { IsDeadCheck("v8::HeapSnapshot::GetChild"); return reinterpret_cast( - &ToInternal(this)->children()[index]); + reinterpret_cast(this)->children()->at(index)); } int HeapGraphNode::GetRetainersCount() const { IsDeadCheck("v8::HeapSnapshot::GetRetainersCount"); - return ToInternal(this)->retainers().length(); + return reinterpret_cast(this)->retainers()->length(); } const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const { IsDeadCheck("v8::HeapSnapshot::GetRetainer"); return reinterpret_cast( - ToInternal(this)->retainers()[index]); + reinterpret_cast(this)->retainers()->at(index)); } int HeapGraphNode::GetRetainingPathsCount() const { IsDeadCheck("v8::HeapSnapshot::GetRetainingPathsCount"); - return ToInternal(this)->GetRetainingPaths()->length(); + return const_cast( + reinterpret_cast( + this))->GetRetainingPaths()->length(); } const HeapGraphPath* HeapGraphNode::GetRetainingPath(int index) const { IsDeadCheck("v8::HeapSnapshot::GetRetainingPath"); return reinterpret_cast( - ToInternal(this)->GetRetainingPaths()->at(index)); + const_cast( + reinterpret_cast( + this))->GetRetainingPaths()->at(index)); } const HeapGraphNode* HeapSnapshotsDiff::GetAdditionsRoot() const { IsDeadCheck("v8::HeapSnapshotsDiff::GetAdditionsRoot"); - i::HeapSnapshotsDiff* diff = - const_cast( - reinterpret_cast(this)); + const i::HeapSnapshotsDiff* diff = + reinterpret_cast(this); return reinterpret_cast(diff->additions_root()); } const HeapGraphNode* HeapSnapshotsDiff::GetDeletionsRoot() const { IsDeadCheck("v8::HeapSnapshotsDiff::GetDeletionsRoot"); - i::HeapSnapshotsDiff* diff = - const_cast( - reinterpret_cast(this)); + const i::HeapSnapshotsDiff* diff = + reinterpret_cast(this); return reinterpret_cast(diff->deletions_root()); } -static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { - return const_cast( - reinterpret_cast(snapshot)); -} - - unsigned HeapSnapshot::GetUid() const { IsDeadCheck("v8::HeapSnapshot::GetUid"); - return ToInternal(this)->uid(); + return reinterpret_cast(this)->uid(); } Handle HeapSnapshot::GetTitle() const { IsDeadCheck("v8::HeapSnapshot::GetTitle"); + const i::HeapSnapshot* snapshot = + reinterpret_cast(this); return Handle(ToApi(i::Factory::LookupAsciiSymbol( - ToInternal(this)->title()))); + snapshot->title()))); } const HeapGraphNode* HeapSnapshot::GetRoot() const { IsDeadCheck("v8::HeapSnapshot::GetHead"); - return reinterpret_cast(ToInternal(this)->root()); + const i::HeapSnapshot* snapshot = + reinterpret_cast(this); + return reinterpret_cast(snapshot->const_root()); } const HeapSnapshotsDiff* HeapSnapshot::CompareWith( const HeapSnapshot* snapshot) const { IsDeadCheck("v8::HeapSnapshot::CompareWith"); + i::HeapSnapshot* snapshot1 = const_cast( + reinterpret_cast(this)); + i::HeapSnapshot* snapshot2 = const_cast( + reinterpret_cast(snapshot)); return reinterpret_cast( - ToInternal(this)->CompareWith(ToInternal(snapshot))); + snapshot1->CompareWith(snapshot2)); } diff --git a/deps/v8/src/arm/builtins-arm.cc b/deps/v8/src/arm/builtins-arm.cc index 37768e8d5f..b1f29ba381 100644 --- a/deps/v8/src/arm/builtins-arm.cc +++ b/deps/v8/src/arm/builtins-arm.cc @@ -1050,7 +1050,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { __ ldr(r2, FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); __ mov(r2, Operand(r2, ASR, kSmiTagSize)); - __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeOffset)); + __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); __ cmp(r2, r0); // Check formal and actual parameter counts. __ Jump(Handle(builtin(ArgumentsAdaptorTrampoline)), diff --git a/deps/v8/src/arm/codegen-arm.cc b/deps/v8/src/arm/codegen-arm.cc index aec80d7315..4bcf1a07df 100644 --- a/deps/v8/src/arm/codegen-arm.cc +++ b/deps/v8/src/arm/codegen-arm.cc @@ -1532,8 +1532,9 @@ void CodeGenerator::CallApplyLazy(Expression* applicand, __ BranchOnSmi(r0, &build_args); __ CompareObjectType(r0, r1, r2, JS_FUNCTION_TYPE); __ b(ne, &build_args); + __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); Handle apply_code(Builtins::builtin(Builtins::FunctionApply)); - __ ldr(r1, FieldMemOperand(r0, JSFunction::kCodeOffset)); + __ ldr(r1, FieldMemOperand(r0, SharedFunctionInfo::kCodeOffset)); __ cmp(r1, Operand(apply_code)); __ b(ne, &build_args); @@ -4175,21 +4176,21 @@ void CodeGenerator::VisitCallNew(CallNew* node) { void CodeGenerator::GenerateClassOf(ZoneList* args) { + VirtualFrame::SpilledScope spilled_scope(frame_); + ASSERT(args->length() == 1); JumpTarget leave, null, function, non_function_constructor; - Register scratch = VirtualFrame::scratch0(); - // Load the object into register. - ASSERT(args->length() == 1); + // Load the object into r0. Load(args->at(0)); - Register tos = frame_->PopToRegister(); + frame_->EmitPop(r0); // If the object is a smi, we return null. - __ tst(tos, Operand(kSmiTagMask)); + __ tst(r0, Operand(kSmiTagMask)); null.Branch(eq); // Check that the object is a JS object but take special care of JS // functions to make sure they have 'Function' as their class. - __ CompareObjectType(tos, tos, scratch, FIRST_JS_OBJECT_TYPE); + __ CompareObjectType(r0, r0, r1, FIRST_JS_OBJECT_TYPE); null.Branch(lt); // As long as JS_FUNCTION_TYPE is the last instance type and it is @@ -4197,38 +4198,37 @@ void CodeGenerator::GenerateClassOf(ZoneList* args) { // LAST_JS_OBJECT_TYPE. STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); - __ cmp(scratch, Operand(JS_FUNCTION_TYPE)); + __ cmp(r1, Operand(JS_FUNCTION_TYPE)); function.Branch(eq); // Check if the constructor in the map is a function. - __ ldr(tos, FieldMemOperand(tos, Map::kConstructorOffset)); - __ CompareObjectType(tos, scratch, scratch, JS_FUNCTION_TYPE); + __ ldr(r0, FieldMemOperand(r0, Map::kConstructorOffset)); + __ CompareObjectType(r0, r1, r1, JS_FUNCTION_TYPE); non_function_constructor.Branch(ne); - // The tos register now contains the constructor function. Grab the + // The r0 register now contains the constructor function. Grab the // instance class name from there. - __ ldr(tos, FieldMemOperand(tos, JSFunction::kSharedFunctionInfoOffset)); - __ ldr(tos, - FieldMemOperand(tos, SharedFunctionInfo::kInstanceClassNameOffset)); - frame_->EmitPush(tos); + __ ldr(r0, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); + __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kInstanceClassNameOffset)); + frame_->EmitPush(r0); leave.Jump(); // Functions have class 'Function'. function.Bind(); - __ mov(tos, Operand(Factory::function_class_symbol())); - frame_->EmitPush(tos); + __ mov(r0, Operand(Factory::function_class_symbol())); + frame_->EmitPush(r0); leave.Jump(); // Objects with a non-function constructor have class 'Object'. non_function_constructor.Bind(); - __ mov(tos, Operand(Factory::Object_symbol())); - frame_->EmitPush(tos); + __ mov(r0, Operand(Factory::Object_symbol())); + frame_->EmitPush(r0); leave.Jump(); // Non-JS objects have class null. null.Bind(); - __ LoadRoot(tos, Heap::kNullValueRootIndex); - frame_->EmitPush(tos); + __ LoadRoot(r0, Heap::kNullValueRootIndex); + frame_->EmitPush(r0); // All done. leave.Bind(); @@ -4236,51 +4236,45 @@ void CodeGenerator::GenerateClassOf(ZoneList* args) { void CodeGenerator::GenerateValueOf(ZoneList* args) { - Register scratch = VirtualFrame::scratch0(); - JumpTarget leave; - + VirtualFrame::SpilledScope spilled_scope(frame_); ASSERT(args->length() == 1); + JumpTarget leave; Load(args->at(0)); - Register tos = frame_->PopToRegister(); // tos contains object. + frame_->EmitPop(r0); // r0 contains object. // if (object->IsSmi()) return the object. - __ tst(tos, Operand(kSmiTagMask)); + __ tst(r0, Operand(kSmiTagMask)); leave.Branch(eq); // It is a heap object - get map. If (!object->IsJSValue()) return the object. - __ CompareObjectType(tos, scratch, scratch, JS_VALUE_TYPE); + __ CompareObjectType(r0, r1, r1, JS_VALUE_TYPE); leave.Branch(ne); // Load the value. - __ ldr(tos, FieldMemOperand(tos, JSValue::kValueOffset)); + __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset)); leave.Bind(); - frame_->EmitPush(tos); + frame_->EmitPush(r0); } void CodeGenerator::GenerateSetValueOf(ZoneList* args) { - Register scratch1 = VirtualFrame::scratch0(); - Register scratch2 = VirtualFrame::scratch1(); - JumpTarget leave; - + VirtualFrame::SpilledScope spilled_scope(frame_); ASSERT(args->length() == 2); + JumpTarget leave; Load(args->at(0)); // Load the object. Load(args->at(1)); // Load the value. - Register value = frame_->PopToRegister(); - Register object = frame_->PopToRegister(value); + frame_->EmitPop(r0); // r0 contains value + frame_->EmitPop(r1); // r1 contains object // if (object->IsSmi()) return object. - __ tst(object, Operand(kSmiTagMask)); + __ tst(r1, Operand(kSmiTagMask)); leave.Branch(eq); // It is a heap object - get map. If (!object->IsJSValue()) return the object. - __ CompareObjectType(object, scratch1, scratch1, JS_VALUE_TYPE); + __ CompareObjectType(r1, r2, r2, JS_VALUE_TYPE); leave.Branch(ne); // Store the value. - __ str(value, FieldMemOperand(object, JSValue::kValueOffset)); + __ str(r0, FieldMemOperand(r1, JSValue::kValueOffset)); // Update the write barrier. - __ RecordWrite(object, - Operand(JSValue::kValueOffset - kHeapObjectTag), - scratch1, - scratch2); + __ RecordWrite(r1, Operand(JSValue::kValueOffset - kHeapObjectTag), r2, r3); // Leave. leave.Bind(); - frame_->EmitPush(value); + frame_->EmitPush(r0); } @@ -4564,18 +4558,22 @@ class DeferredStringCharCodeAt : public DeferredCode { // This generates code that performs a String.prototype.charCodeAt() call // or returns a smi in order to trigger conversion. void CodeGenerator::GenerateStringCharCodeAt(ZoneList* args) { + VirtualFrame::SpilledScope spilled_scope(frame_); Comment(masm_, "[ GenerateStringCharCodeAt"); ASSERT(args->length() == 2); Load(args->at(0)); Load(args->at(1)); - Register index = frame_->PopToRegister(); - Register object = frame_->PopToRegister(index); + Register index = r1; + Register object = r2; + + frame_->EmitPop(r1); + frame_->EmitPop(r2); // We need two extra registers. - Register scratch = VirtualFrame::scratch0(); - Register result = VirtualFrame::scratch1(); + Register scratch = r3; + Register result = r0; DeferredStringCharCodeAt* deferred = new DeferredStringCharCodeAt(object, @@ -4610,13 +4608,16 @@ class DeferredStringCharFromCode : public DeferredCode { // Generates code for creating a one-char string from a char code. void CodeGenerator::GenerateStringCharFromCode(ZoneList* args) { + VirtualFrame::SpilledScope spilled_scope(frame_); Comment(masm_, "[ GenerateStringCharFromCode"); ASSERT(args->length() == 1); Load(args->at(0)); - Register result = frame_->GetTOSRegister(); - Register code = frame_->PopToRegister(result); + Register code = r1; + Register result = r0; + + frame_->EmitPop(code); DeferredStringCharFromCode* deferred = new DeferredStringCharFromCode( code, result); @@ -4678,20 +4679,23 @@ class DeferredStringCharAt : public DeferredCode { // This generates code that performs a String.prototype.charAt() call // or returns a smi in order to trigger conversion. void CodeGenerator::GenerateStringCharAt(ZoneList* args) { + VirtualFrame::SpilledScope spilled_scope(frame_); Comment(masm_, "[ GenerateStringCharAt"); ASSERT(args->length() == 2); Load(args->at(0)); Load(args->at(1)); - Register index = frame_->PopToRegister(); - Register object = frame_->PopToRegister(index); + Register index = r1; + Register object = r2; + + frame_->EmitPop(r1); + frame_->EmitPop(r2); // We need three extra registers. - Register scratch1 = VirtualFrame::scratch0(); - Register scratch2 = VirtualFrame::scratch1(); - // Use r6 without notifying the virtual frame. - Register result = r6; + Register scratch1 = r3; + Register scratch2 = r4; + Register result = r0; DeferredStringCharAt* deferred = new DeferredStringCharAt(object, @@ -4870,13 +4874,13 @@ void CodeGenerator::GenerateArgumentsLength(ZoneList* args) { void CodeGenerator::GenerateArguments(ZoneList* args) { + VirtualFrame::SpilledScope spilled_scope(frame_); ASSERT(args->length() == 1); // Satisfy contract with ArgumentsAccessStub: // Load the key into r1 and the formal parameters count into r0. Load(args->at(0)); - frame_->PopToR1(); - frame_->SpillAll(); + frame_->EmitPop(r1); __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); // Call the shared stub to get to arguments[key]. @@ -5104,7 +5108,9 @@ class DeferredSearchCache: public DeferredCode { void DeferredSearchCache::Generate() { __ Push(cache_, key_); __ CallRuntime(Runtime::kGetFromCache, 2); - __ Move(dst_, r0); + if (!dst_.is(r0)) { + __ mov(dst_, r0); + } } @@ -5124,42 +5130,33 @@ void CodeGenerator::GenerateGetFromCache(ZoneList* args) { Load(args->at(1)); - frame_->PopToR1(); - frame_->SpillAll(); - Register key = r1; // Just poped to r1 - Register result = r0; // Free, as frame has just been spilled. - Register scratch1 = VirtualFrame::scratch0(); - Register scratch2 = VirtualFrame::scratch1(); + VirtualFrame::SpilledScope spilled_scope(frame_); - __ ldr(scratch1, ContextOperand(cp, Context::GLOBAL_INDEX)); - __ ldr(scratch1, - FieldMemOperand(scratch1, GlobalObject::kGlobalContextOffset)); - __ ldr(scratch1, - ContextOperand(scratch1, Context::JSFUNCTION_RESULT_CACHES_INDEX)); - __ ldr(scratch1, - FieldMemOperand(scratch1, FixedArray::OffsetOfElementAt(cache_id))); + frame_->EmitPop(r2); + + __ ldr(r1, ContextOperand(cp, Context::GLOBAL_INDEX)); + __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalContextOffset)); + __ ldr(r1, ContextOperand(r1, Context::JSFUNCTION_RESULT_CACHES_INDEX)); + __ ldr(r1, FieldMemOperand(r1, FixedArray::OffsetOfElementAt(cache_id))); - DeferredSearchCache* deferred = - new DeferredSearchCache(result, scratch1, key); + DeferredSearchCache* deferred = new DeferredSearchCache(r0, r1, r2); const int kFingerOffset = FixedArray::OffsetOfElementAt(JSFunctionResultCache::kFingerIndex); STATIC_ASSERT(kSmiTag == 0 && kSmiTagSize == 1); - __ ldr(result, FieldMemOperand(scratch1, kFingerOffset)); - // result now holds finger offset as a smi. - __ add(scratch2, scratch1, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); - // scratch2 now points to the start of fixed array elements. - __ ldr(result, - MemOperand( - scratch2, result, LSL, kPointerSizeLog2 - kSmiTagSize, PreIndex)); - // Note side effect of PreIndex: scratch2 now points to the key of the pair. - __ cmp(key, result); + __ ldr(r0, FieldMemOperand(r1, kFingerOffset)); + // r0 now holds finger offset as a smi. + __ add(r3, r1, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); + // r3 now points to the start of fixed array elements. + __ ldr(r0, MemOperand(r3, r0, LSL, kPointerSizeLog2 - kSmiTagSize, PreIndex)); + // Note side effect of PreIndex: r3 now points to the key of the pair. + __ cmp(r2, r0); deferred->Branch(ne); - __ ldr(result, MemOperand(scratch2, kPointerSize)); + __ ldr(r0, MemOperand(r3, kPointerSize)); deferred->BindExit(); - frame_->EmitPush(result); + frame_->EmitPush(r0); } @@ -6854,11 +6851,6 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) { __ str(cp, FieldMemOperand(r0, JSFunction::kContextOffset)); __ str(r1, FieldMemOperand(r0, JSFunction::kLiteralsOffset)); - // Initialize the code pointer in the function to be the one - // found in the shared function info object. - __ ldr(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset)); - __ str(r3, FieldMemOperand(r0, JSFunction::kCodeOffset)); - // Return result. The argument function info has been popped already. __ Ret(); @@ -10452,9 +10444,11 @@ void StringCharCodeAtGenerator::GenerateSlow( // NumberToSmi discards numbers that are not exact integers. __ CallRuntime(Runtime::kNumberToSmi, 1); } - // Save the conversion result before the pop instructions below - // have a chance to overwrite it. - __ Move(scratch_, r0); + if (!scratch_.is(r0)) { + // Save the conversion result before the pop instructions below + // have a chance to overwrite it. + __ mov(scratch_, r0); + } __ pop(index_); __ pop(object_); // Reload the instance type. @@ -10473,7 +10467,9 @@ void StringCharCodeAtGenerator::GenerateSlow( call_helper.BeforeCall(masm); __ Push(object_, index_); __ CallRuntime(Runtime::kStringCharCodeAt, 2); - __ Move(result_, r0); + if (!result_.is(r0)) { + __ mov(result_, r0); + } call_helper.AfterCall(masm); __ jmp(&exit_); @@ -10514,7 +10510,9 @@ void StringCharFromCodeGenerator::GenerateSlow( call_helper.BeforeCall(masm); __ push(code_); __ CallRuntime(Runtime::kCharFromCode, 1); - __ Move(result_, r0); + if (!result_.is(r0)) { + __ mov(result_, r0); + } call_helper.AfterCall(masm); __ jmp(&exit_); diff --git a/deps/v8/src/arm/macro-assembler-arm.cc b/deps/v8/src/arm/macro-assembler-arm.cc index 7a03641a2f..9c25ccde2f 100644 --- a/deps/v8/src/arm/macro-assembler-arm.cc +++ b/deps/v8/src/arm/macro-assembler-arm.cc @@ -757,7 +757,7 @@ void MacroAssembler::InvokeFunction(Register fun, SharedFunctionInfo::kFormalParameterCountOffset)); mov(expected_reg, Operand(expected_reg, ASR, kSmiTagSize)); ldr(code_reg, - MemOperand(r1, JSFunction::kCodeOffset - kHeapObjectTag)); + MemOperand(code_reg, SharedFunctionInfo::kCodeOffset - kHeapObjectTag)); add(code_reg, code_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); ParameterCount expected(expected_reg); @@ -1508,7 +1508,8 @@ void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { // Make sure the code objects in the builtins object and in the // builtin function are the same. push(r1); - ldr(r1, FieldMemOperand(r1, JSFunction::kCodeOffset)); + ldr(r1, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); + ldr(r1, FieldMemOperand(r1, SharedFunctionInfo::kCodeOffset)); cmp(r1, target); Assert(eq, "Builtin code object changed"); pop(r1); diff --git a/deps/v8/src/bootstrapper.cc b/deps/v8/src/bootstrapper.cc index 0d59505c09..e1d4489d44 100644 --- a/deps/v8/src/bootstrapper.cc +++ b/deps/v8/src/bootstrapper.cc @@ -56,7 +56,7 @@ class SourceCodeCache BASE_EMBEDDED { } void Iterate(ObjectVisitor* v) { - v->VisitPointer(BitCast(&cache_)); + v->VisitPointer(BitCast(&cache_)); } @@ -470,7 +470,6 @@ Handle Genesis::CreateEmptyFunction() { Handle code = Handle(Builtins::builtin(Builtins::EmptyFunction)); empty_function->set_code(*code); - empty_function->shared()->set_code(*code); Handle source = Factory::NewStringFromAscii(CStrVector("() {}")); Handle