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

Side by Side Diff: src/fast-codegen.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/fast-codegen.h ('k') | src/ia32/fast-codegen-ia32.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 208
209 void FastCodeGenSyntaxChecker::VisitSlot(Slot* expr) { 209 void FastCodeGenSyntaxChecker::VisitSlot(Slot* expr) {
210 UNREACHABLE(); 210 UNREACHABLE();
211 } 211 }
212 212
213 213
214 void FastCodeGenSyntaxChecker::VisitVariableProxy(VariableProxy* expr) { 214 void FastCodeGenSyntaxChecker::VisitVariableProxy(VariableProxy* expr) {
215 // Only global variable references are supported. 215 // Only global variable references are supported.
216 Variable* var = expr->var(); 216 Variable* var = expr->var();
217 if (!var->is_global()) BAILOUT("Non-global variable"); 217 if (!var->is_global() || var->is_this()) BAILOUT("Non-global variable");
218
219 // Check if the global variable is existing and non-deletable.
220 if (info()->has_global_object()) {
221 LookupResult lookup;
222 info()->global_object()->Lookup(*expr->name(), &lookup);
223 if (!lookup.IsValid() || !lookup.IsDontDelete()) {
224 BAILOUT("Non-existing or deletable global variable");
225 }
226 }
218 } 227 }
219 228
220 229
221 void FastCodeGenSyntaxChecker::VisitLiteral(Literal* expr) { 230 void FastCodeGenSyntaxChecker::VisitLiteral(Literal* expr) {
222 BAILOUT("Literal"); 231 BAILOUT("Literal");
223 } 232 }
224 233
225 234
226 void FastCodeGenSyntaxChecker::VisitRegExpLiteral(RegExpLiteral* expr) { 235 void FastCodeGenSyntaxChecker::VisitRegExpLiteral(RegExpLiteral* expr) {
227 BAILOUT("RegExpLiteral"); 236 BAILOUT("RegExpLiteral");
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 487 }
479 488
480 489
481 void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) { 490 void FastCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
482 ASSERT(expr->var()->is_global() && !expr->var()->is_this()); 491 ASSERT(expr->var()->is_global() && !expr->var()->is_this());
483 Comment cmnt(masm(), ";; Global"); 492 Comment cmnt(masm(), ";; Global");
484 if (FLAG_print_ir) { 493 if (FLAG_print_ir) {
485 SmartPointer<char> name = expr->name()->ToCString(); 494 SmartPointer<char> name = expr->name()->ToCString();
486 PrintF("%d: t%d = Global(%s)\n", expr->num(), expr->num(), *name); 495 PrintF("%d: t%d = Global(%s)\n", expr->num(), expr->num(), *name);
487 } 496 }
488 EmitGlobalVariableLoad(expr->name()); 497
498 // Check if we can compile a global variable load directly from the cell.
499 ASSERT(info()->has_global_object());
500 LookupResult lookup;
501 info()->global_object()->Lookup(*expr->name(), &lookup);
502 // We only support DontDelete properties for now.
503 ASSERT(lookup.isValid());
504 ASSERT(lookup.IsDontDelete());
505 Handle<Object> cell(info()->global_object()->GetPropertyCell(&lookup));
506 EmitGlobalVariableLoad(cell);
489 } 507 }
490 508
491 509
492 void FastCodeGenerator::VisitLiteral(Literal* expr) { 510 void FastCodeGenerator::VisitLiteral(Literal* expr) {
493 UNREACHABLE(); 511 UNREACHABLE();
494 } 512 }
495 513
496 514
497 void FastCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { 515 void FastCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
498 UNREACHABLE(); 516 UNREACHABLE();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 601
584 602
585 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) { 603 void FastCodeGenerator::VisitThisFunction(ThisFunction* expr) {
586 UNREACHABLE(); 604 UNREACHABLE();
587 } 605 }
588 606
589 #undef __ 607 #undef __
590 608
591 609
592 } } // namespace v8::internal 610 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/fast-codegen.h ('k') | src/ia32/fast-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698