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

Unified Diff: src/x64/fast-codegen-x64.cc

Issue 565034: Fast compiler: Load globals variables directly from property cells.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Merge 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/ia32/macro-assembler-ia32.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/fast-codegen-x64.cc
===================================================================
--- src/x64/fast-codegen-x64.cc (revision 3807)
+++ src/x64/fast-codegen-x64.cc (working copy)
@@ -48,41 +48,47 @@
PrintF("MapCheck(this)\n");
}
+ ASSERT(info()->has_receiver() && info()->receiver()->IsHeapObject());
+ Handle<HeapObject> object = Handle<HeapObject>::cast(info()->receiver());
+ Handle<Map> map(object->map());
+
EmitLoadReceiver(rdx);
- __ JumpIfSmi(rdx, bailout());
+ __ CheckMap(rdx, map, bailout(), false);
+}
- ASSERT(has_receiver() && receiver()->IsHeapObject());
- Handle<HeapObject> object = Handle<HeapObject>::cast(receiver());
- Handle<Map> map(object->map());
- __ Cmp(FieldOperand(rdx, HeapObject::kMapOffset), map);
- __ j(not_equal, bailout());
+
+void FastCodeGenerator::EmitGlobalMapCheck() {
+ Comment cmnt(masm(), ";; GlobalMapCheck");
+ if (FLAG_print_ir) {
+ PrintF(";; GlobalMapCheck()");
+ }
+
+ ASSERT(info()->has_global_object());
+ Handle<Map> map(info()->global_object()->map());
+
+ __ movq(rbx, CodeGenerator::GlobalObject());
+ __ CheckMap(rbx, map, bailout(), true);
}
-void FastCodeGenerator::EmitGlobalVariableLoad(Handle<String> name) {
- // Compile global variable accesses as load IC calls. The only live
- // registers are rsi (context) and possibly rdx (this). Both are also
- // saved in the stack and rsi is preserved by the call.
- __ push(CodeGenerator::GlobalObject());
- __ Move(rcx, name);
- Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
- __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
- if (has_this_properties()) {
- // Restore this.
- EmitLoadReceiver(rdx);
- } else {
- __ nop(); // Not test rax, indicates IC has no inlined code at call site.
+void FastCodeGenerator::EmitGlobalVariableLoad(Handle<Object> cell) {
+ ASSERT(cell->IsJSGlobalPropertyCell());
+ __ Move(rax, cell);
+ __ movq(rax, FieldOperand(rax, JSGlobalPropertyCell::kValueOffset));
+ if (FLAG_debug_code) {
+ __ Cmp(rax, Factory::the_hole_value());
+ __ Check(not_equal, "DontDelete cells can't contain the hole");
}
}
void FastCodeGenerator::EmitThisPropertyStore(Handle<String> name) {
LookupResult lookup;
- receiver()->Lookup(*name, &lookup);
+ info()->receiver()->Lookup(*name, &lookup);
- ASSERT(lookup.holder() == *receiver());
+ ASSERT(lookup.holder() == *info()->receiver());
ASSERT(lookup.type() == FIELD);
- Handle<Map> map(Handle<HeapObject>::cast(receiver())->map());
+ Handle<Map> map(Handle<HeapObject>::cast(info()->receiver())->map());
int index = lookup.GetFieldIndex() - map->inobject_properties();
int offset = index * kPointerSize;
@@ -102,9 +108,9 @@
}
-void FastCodeGenerator::Generate(CompilationInfo* info) {
+void FastCodeGenerator::Generate(CompilationInfo* compilation_info) {
ASSERT(info_ == NULL);
- info_ = info;
+ info_ = compilation_info;
// Save the caller's frame pointer and set up our own.
Comment prologue_cmnt(masm(), ";; Prologue");
@@ -116,10 +122,14 @@
// point.
// Receiver (this) is allocated to rdx if there are this properties.
- if (has_this_properties()) EmitReceiverMapCheck();
+ if (info()->has_this_properties()) EmitReceiverMapCheck();
- VisitStatements(info->function()->body());
+ // If there is a global variable access check if the global object
+ // is the same as at lazy-compilation time.
+ if (info()->has_globals()) EmitGlobalMapCheck();
+ VisitStatements(info()->function()->body());
+
Comment return_cmnt(masm(), ";; Return(<undefined>)");
__ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698