Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 1638006: One less dependent load in InvokeBuiltin. (Closed)
Patch Set: . Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 // Rely on the assertion to check that the number of provided 1389 // Rely on the assertion to check that the number of provided
1390 // arguments match the expected number of arguments. Fake a 1390 // arguments match the expected number of arguments. Fake a
1391 // parameter count to avoid emitting code to do the check. 1391 // parameter count to avoid emitting code to do the check.
1392 ParameterCount expected(0); 1392 ParameterCount expected(0);
1393 GetBuiltinEntry(edx, id); 1393 GetBuiltinEntry(edx, id);
1394 InvokeCode(Operand(edx), expected, expected, flag); 1394 InvokeCode(Operand(edx), expected, expected, flag);
1395 } 1395 }
1396 1396
1397 1397
1398 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { 1398 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
1399 ASSERT(!target.is(edi));
1400
1401 // Load the builtins object into target register.
1402 mov(target, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)));
1403 mov(target, FieldOperand(target, GlobalObject::kBuiltinsOffset));
1404
1399 // Load the JavaScript builtin function from the builtins object. 1405 // Load the JavaScript builtin function from the builtins object.
1400 mov(edi, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); 1406 mov(edi, FieldOperand(target, JSBuiltinsObject::OffsetOfFunctionWithId(id)));
1401 mov(edi, FieldOperand(edi, GlobalObject::kBuiltinsOffset)); 1407
1402 int builtins_offset = 1408 // Load the code entry point from the builtins object.
1403 JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize); 1409 mov(target, FieldOperand(target, JSBuiltinsObject::OffsetOfCodeWithId(id)));
1404 mov(edi, FieldOperand(edi, builtins_offset)); 1410 lea(target, FieldOperand(target, Code::kHeaderSize));
1405 // Load the code entry point from the function into the target register.
1406 mov(target, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
1407 mov(target, FieldOperand(target, SharedFunctionInfo::kCodeOffset));
1408 add(Operand(target), Immediate(Code::kHeaderSize - kHeapObjectTag));
1409 } 1411 }
1410 1412
1411 1413
1412 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { 1414 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
1413 if (context_chain_length > 0) { 1415 if (context_chain_length > 0) {
1414 // Move up the chain of contexts to the context containing the slot. 1416 // Move up the chain of contexts to the context containing the slot.
1415 mov(dst, Operand(esi, Context::SlotOffset(Context::CLOSURE_INDEX))); 1417 mov(dst, Operand(esi, Context::SlotOffset(Context::CLOSURE_INDEX)));
1416 // Load the function context (which is the incoming, outer context). 1418 // Load the function context (which is the incoming, outer context).
1417 mov(dst, FieldOperand(dst, JSFunction::kContextOffset)); 1419 mov(dst, FieldOperand(dst, JSFunction::kContextOffset));
1418 for (int i = 1; i < context_chain_length; i++) { 1420 for (int i = 1; i < context_chain_length; i++) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 // Indicate that code has changed. 1646 // Indicate that code has changed.
1645 CPU::FlushICache(address_, size_); 1647 CPU::FlushICache(address_, size_);
1646 1648
1647 // Check that the code was patched as expected. 1649 // Check that the code was patched as expected.
1648 ASSERT(masm_.pc_ == address_ + size_); 1650 ASSERT(masm_.pc_ == address_ + size_);
1649 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1651 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1650 } 1652 }
1651 1653
1652 1654
1653 } } // namespace v8::internal 1655 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698