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

Unified Diff: src/arm/macro-assembler-arm.cc

Issue 594009: Always load the JavaScript builtins code entry from the JavaScript... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/bootstrapper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/macro-assembler-arm.cc
===================================================================
--- src/arm/macro-assembler-arm.cc (revision 3824)
+++ src/arm/macro-assembler-arm.cc (working copy)
@@ -37,7 +37,6 @@
MacroAssembler::MacroAssembler(void* buffer, int size)
: Assembler(buffer, size),
- unresolved_(0),
generating_stub_(false),
allow_stub_calls_(true),
code_object_(Heap::undefined_value()) {
@@ -1233,58 +1232,29 @@
}
-Handle<Code> MacroAssembler::ResolveBuiltin(Builtins::JavaScript id,
- bool* resolved) {
- // Contract with compiled functions is that the function is passed in r1.
- int builtins_offset =
- JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize);
- ldr(r1, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
- ldr(r1, FieldMemOperand(r1, GlobalObject::kBuiltinsOffset));
- ldr(r1, FieldMemOperand(r1, builtins_offset));
-
- return Builtins::GetCode(id, resolved);
-}
-
-
void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
InvokeJSFlags flags) {
- bool resolved;
- Handle<Code> code = ResolveBuiltin(id, &resolved);
-
+ GetBuiltinEntry(r2, id);
if (flags == CALL_JS) {
- Call(code, RelocInfo::CODE_TARGET);
+ Call(r2);
} else {
ASSERT(flags == JUMP_JS);
- Jump(code, RelocInfo::CODE_TARGET);
+ Jump(r2);
}
-
- if (!resolved) {
- const char* name = Builtins::GetName(id);
- int argc = Builtins::GetArgumentsCount(id);
- uint32_t flags =
- Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
- Bootstrapper::FixupFlagsUseCodeObject::encode(false);
- Unresolved entry = { pc_offset() - kInstrSize, flags, name };
- unresolved_.Add(entry);
- }
}
void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
- bool resolved;
- Handle<Code> code = ResolveBuiltin(id, &resolved);
-
- mov(target, Operand(code));
- if (!resolved) {
- const char* name = Builtins::GetName(id);
- int argc = Builtins::GetArgumentsCount(id);
- uint32_t flags =
- Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
- Bootstrapper::FixupFlagsUseCodeObject::encode(true);
- Unresolved entry = { pc_offset() - kInstrSize, flags, name };
- unresolved_.Add(entry);
- }
-
+ // Load the JavaScript builtin function from the builtins object
+ // using the target register as a scratch register.
+ ldr(target, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX)));
+ ldr(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset));
+ int builtins_offset =
+ JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize);
+ ldr(r1, FieldMemOperand(target, builtins_offset));
Erik Corry 2010/02/10 17:22:49 Seems like you might as well just use r1 throughou
Mads Ager (chromium) 2010/02/11 07:58:30 Yes, done on all platforms.
+ // Load the code entry point from the function into the target register.
+ ldr(target, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
+ ldr(target, FieldMemOperand(target, SharedFunctionInfo::kCodeOffset));
Erik Corry 2010/02/10 17:22:49 A chain of 5 dependent loads! If this turns out t
add(target, target, Operand(Code::kHeaderSize - kHeapObjectTag));
}
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/bootstrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698