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

Side by Side Diff: src/compiler.cc

Issue 303021: Added support for array literals to the toplevel compiler. They are... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 2 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/arm/fast-codegen-arm.cc ('k') | src/fast-codegen.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 CodeGenSelector::CodeGenTag CodeGenSelector::Select(FunctionLiteral* fun) { 451 CodeGenSelector::CodeGenTag CodeGenSelector::Select(FunctionLiteral* fun) {
452 Scope* scope = fun->scope(); 452 Scope* scope = fun->scope();
453 453
454 if (!scope->is_global_scope()) { 454 if (!scope->is_global_scope()) {
455 if (FLAG_trace_bailout) PrintF("Non-global scope\n"); 455 if (FLAG_trace_bailout) PrintF("Non-global scope\n");
456 return NORMAL; 456 return NORMAL;
457 } 457 }
458 ASSERT(scope->num_heap_slots() == 0); 458 ASSERT(scope->num_heap_slots() == 0);
459 ASSERT(scope->arguments() == NULL); 459 ASSERT(scope->arguments() == NULL);
460 460
461 if (fun->materialized_literal_count() > 0) {
462 if (FLAG_trace_bailout) PrintF("Unsupported literal\n");
463 return NORMAL;
464 }
465
466 has_supported_syntax_ = true; 461 has_supported_syntax_ = true;
467 VisitDeclarations(fun->scope()->declarations()); 462 VisitDeclarations(fun->scope()->declarations());
468 if (!has_supported_syntax_) return NORMAL; 463 if (!has_supported_syntax_) return NORMAL;
469 464
470 VisitStatements(fun->body()); 465 VisitStatements(fun->body());
471 return has_supported_syntax_ ? FAST : NORMAL; 466 return has_supported_syntax_ ? FAST : NORMAL;
472 } 467 }
473 468
474 469
475 #define BAILOUT(reason) \ 470 #define BAILOUT(reason) \
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 BAILOUT("RegExpLiteral"); 637 BAILOUT("RegExpLiteral");
643 } 638 }
644 639
645 640
646 void CodeGenSelector::VisitObjectLiteral(ObjectLiteral* expr) { 641 void CodeGenSelector::VisitObjectLiteral(ObjectLiteral* expr) {
647 BAILOUT("ObjectLiteral"); 642 BAILOUT("ObjectLiteral");
648 } 643 }
649 644
650 645
651 void CodeGenSelector::VisitArrayLiteral(ArrayLiteral* expr) { 646 void CodeGenSelector::VisitArrayLiteral(ArrayLiteral* expr) {
652 BAILOUT("ArrayLiteral"); 647 ZoneList<Expression*>* subexprs = expr->values();
648 for (int i = 0, len = subexprs->length(); i < len; i++) {
649 Expression* subexpr = subexprs->at(i);
650 if (subexpr->AsLiteral() != NULL) continue;
651 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue;
652 Visit(subexpr);
653 CHECK_BAILOUT;
654 }
653 } 655 }
654 656
655 657
656 void CodeGenSelector::VisitCatchExtensionObject(CatchExtensionObject* expr) { 658 void CodeGenSelector::VisitCatchExtensionObject(CatchExtensionObject* expr) {
657 BAILOUT("CatchExtensionObject"); 659 BAILOUT("CatchExtensionObject");
658 } 660 }
659 661
660 662
661 void CodeGenSelector::VisitAssignment(Assignment* expr) { 663 void CodeGenSelector::VisitAssignment(Assignment* expr) {
662 // We support plain non-compound assignments to parameters and 664 // We support plain non-compound assignments to parameters and
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 761
760 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { 762 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) {
761 BAILOUT("ThisFunction"); 763 BAILOUT("ThisFunction");
762 } 764 }
763 765
764 #undef BAILOUT 766 #undef BAILOUT
765 #undef CHECK_BAILOUT 767 #undef CHECK_BAILOUT
766 768
767 769
768 } } // namespace v8::internal 770 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/fast-codegen-arm.cc ('k') | src/fast-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698