Reviewers: Kevin Millikin, Message: A small review for you.
Description: X64: Add inline cache stub for storing to globals. Please review this at http://codereview.chromium.org/160160 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/x64/stub-cache-x64.cc M test/mjsunit/mjsunit.status Index: test/mjsunit/mjsunit.status =================================================================== --- test/mjsunit/mjsunit.status (revision 2542) +++ test/mjsunit/mjsunit.status (working copy) @@ -98,7 +98,7 @@ debug-stepin-constructor: CRASH || FAIL debug-stepin-function-call: CRASH || FAIL debug-stepin-accessor: CRASH || FAIL -new: CRASH || FAIL +new: PASS, CRASH || FAIL if ($mode == debug) fuzz-natives: PASS || TIMEOUT greedy: PASS || TIMEOUT debug-handle: CRASH || FAIL Index: src/x64/stub-cache-x64.cc =================================================================== --- src/x64/stub-cache-x64.cc (revision 2542) +++ src/x64/stub-cache-x64.cc (working copy) @@ -471,8 +471,38 @@ Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, JSGlobalPropertyCell* cell, String* name) { - // TODO(X64): Implement a real stub. - return Failure::InternalError(); + // ----------- S t a t e ------------- + // -- rax : value + // -- rcx : name + // -- rsp[0] : return address + // -- rsp[8] : receiver + // ----------------------------------- + Label miss; + + __ IncrementCounter(&Counters::named_store_global_inline, 1); + + // Check that the map of the global has not changed. + __ movq(rbx, Operand(rsp, kPointerSize)); + __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), + Handle<Map>(object->map())); + __ j(not_equal, &miss); + + // Store the value in the cell. + __ Move(rcx, Handle<JSGlobalPropertyCell>(cell)); + __ movq(FieldOperand(rcx, JSGlobalPropertyCell::kValueOffset), rax); + + // Return the value (register rax). + __ ret(0); + + // Handle store cache miss. + __ bind(&miss); + __ DecrementCounter(&Counters::named_store_global_inline, 1); + __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); + Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); + __ Jump(ic, RelocInfo::CODE_TARGET); + + // Return the generated code. + return GetCode(NORMAL, name); } --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
