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

Unified Diff: src/arm/fast-codegen-arm.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 | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/fast-codegen-arm.cc
===================================================================
--- src/arm/fast-codegen-arm.cc (revision 3807)
+++ src/arm/fast-codegen-arm.cc (working copy)
@@ -48,42 +48,48 @@
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(r1);
- __ BranchOnSmi(r1, bailout());
+ __ CheckMap(r1, r3, map, bailout(), false);
+}
- ASSERT(has_receiver() && receiver()->IsHeapObject());
- Handle<HeapObject> object = Handle<HeapObject>::cast(receiver());
- Handle<Map> map(object->map());
- __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset));
- __ mov(ip, Operand(map));
- __ cmp(r3, ip);
- __ b(ne, 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());
+
+ __ ldr(r3, CodeGenerator::GlobalObject());
+ __ CheckMap(r3, r3, map, bailout(), true);
}
-void FastCodeGenerator::EmitGlobalVariableLoad(Handle<String> name) {
- // Compile global variable accesses as load IC calls. The only live
- // registers are cp (context) and possibly r1 (this). Both are also saved
- // in the stack and cp is preserved by the call.
- __ ldr(ip, CodeGenerator::GlobalObject());
- __ push(ip);
- __ mov(r2, Operand(name));
- Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
- __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT);
- if (has_this_properties()) {
- // Restore this.
- EmitLoadReceiver(r1);
+void FastCodeGenerator::EmitGlobalVariableLoad(Handle<Object> cell) {
+ ASSERT(cell->IsJSGlobalPropertyCell());
+ __ mov(r0, Operand(cell));
+ __ ldr(r0, FieldMemOperand(r0, JSGlobalPropertyCell::kValueOffset));
+ if (FLAG_debug_code) {
+ __ mov(ip, Operand(Factory::the_hole_value()));
+ __ cmp(r0, ip);
+ __ Check(ne, "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");
@@ -114,8 +120,12 @@
// this point.
// Receiver (this) is allocated to r1 if there are this properties.
- if (has_this_properties()) EmitReceiverMapCheck();
+ if (info()->has_this_properties()) EmitReceiverMapCheck();
+ // 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(function()->body());
Comment return_cmnt(masm(), ";; Return(<undefined>)");
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698