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

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

Issue 131029: X64 implementation: Add function literals and function calls. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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/x64/macro-assembler-x64.h ('k') | src/x64/virtual-frame-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/macro-assembler-x64.cc
===================================================================
--- src/x64/macro-assembler-x64.cc (revision 2216)
+++ src/x64/macro-assembler-x64.cc (working copy)
@@ -206,6 +206,44 @@
}
+void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
+ bool resolved;
+ Handle<Code> code = ResolveBuiltin(id, &resolved);
+
+ const char* name = Builtins::GetName(id);
+ int argc = Builtins::GetArgumentsCount(id);
+
+ movq(target, code, RelocInfo::EXTERNAL_REFERENCE); // Is external reference?
Lasse Reichstein 2009/06/18 10:57:55 No, a Code object is an embedded object or code ta
+ if (!resolved) {
+ uint32_t flags =
+ Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
+ Bootstrapper::FixupFlagsIsPCRelative::encode(false) |
+ Bootstrapper::FixupFlagsUseCodeObject::encode(true);
+ Unresolved entry = { pc_offset() - sizeof(intptr_t), flags, name };
+ unresolved_.Add(entry);
+ }
+ addq(target, Immediate(Code::kHeaderSize - kHeapObjectTag));
+}
+
+
+Handle<Code> MacroAssembler::ResolveBuiltin(Builtins::JavaScript id,
+ bool* resolved) {
+ // Move the builtin function into the temporary function slot by
+ // reading it from the builtins object. NOTE: We should be able to
+ // reduce this to two instructions by putting the function table in
+ // the global object instead of the "builtins" object and by using a
+ // real register for the function.
+ movq(rdx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
+ movq(rdx, FieldOperand(rdx, GlobalObject::kBuiltinsOffset));
+ int builtins_offset =
+ JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize);
+ movq(rdi, FieldOperand(rdx, builtins_offset));
+
+
+ return Builtins::GetCode(id, resolved);
+}
+
+
void MacroAssembler::Set(Register dst, int64_t x) {
if (is_int32(x)) {
movq(dst, Immediate(x));
@@ -241,6 +279,14 @@
}
+void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) {
+ WriteRecordedPositions();
+ ASSERT(RelocInfo::IsCodeTarget(rmode));
+ movq(kScratchRegister, code_object, rmode);
+ jmp(kScratchRegister);
+}
+
+
void MacroAssembler::Call(ExternalReference ext) {
movq(kScratchRegister, ext);
call(kScratchRegister);
@@ -253,6 +299,14 @@
}
+void MacroAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) {
+ WriteRecordedPositions();
+ ASSERT(RelocInfo::IsCodeTarget(rmode));
+ movq(kScratchRegister, code_object, rmode);
+ call(kScratchRegister);
+}
+
+
void MacroAssembler::PushTryHandler(CodeLocation try_location,
HandlerType type) {
// Adjust this code if not the case.
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/virtual-frame-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698