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

Side by Side Diff: src/codegen-ia32.cc

Issue 27128: Go into slow case when encountering object initialization on the top level to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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/ast.h ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after
2751 } 2751 }
2752 2752
2753 2753
2754 void CodeGenerator::VisitAssignment(Assignment* node) { 2754 void CodeGenerator::VisitAssignment(Assignment* node) {
2755 Comment cmnt(masm_, "[ Assignment"); 2755 Comment cmnt(masm_, "[ Assignment");
2756 CodeForStatement(node); 2756 CodeForStatement(node);
2757 2757
2758 Reference target(this, node->target()); 2758 Reference target(this, node->target());
2759 if (target.is_illegal()) return; 2759 if (target.is_illegal()) return;
2760 2760
2761 if (node->starts_initialization_block()) {
2762 ASSERT(target.type() == Reference::NAMED ||
2763 target.type() == Reference::KEYED);
2764 // Changing to slow case in the beginning of an initialization block
Mads Ager (chromium) 2009/02/25 13:11:07 Change to slow case ... to avoid ... or Changing
olehougaard 2009/02/26 07:31:44 Fixed
2765 // to avoid the quadratic behavior of repeatedly adding fast properties.
2766 int stack_position = (target.type() == Reference::NAMED) ? 0 : 1;
2767 frame_->Push(Operand(esp, stack_position * kPointerSize));
2768 __ CallRuntime(Runtime::kToSlowProperties, 1);
2769 }
2761 if (node->op() == Token::ASSIGN || 2770 if (node->op() == Token::ASSIGN ||
2762 node->op() == Token::INIT_VAR || 2771 node->op() == Token::INIT_VAR ||
2763 node->op() == Token::INIT_CONST) { 2772 node->op() == Token::INIT_CONST) {
2764 Load(node->value()); 2773 Load(node->value());
2765 2774
2766 } else { 2775 } else {
2767 target.GetValue(NOT_INSIDE_TYPEOF); 2776 target.GetValue(NOT_INSIDE_TYPEOF);
2768 Literal* literal = node->value()->AsLiteral(); 2777 Literal* literal = node->value()->AsLiteral();
2769 if (IsInlineSmi(literal)) { 2778 if (IsInlineSmi(literal)) {
2770 SmiOperation(node->binary_op(), node->type(), literal->handle(), false, 2779 SmiOperation(node->binary_op(), node->type(), literal->handle(), false,
(...skipping 11 matching lines...) Expand all
2782 // Assignment ignored - leave the value on the stack. 2791 // Assignment ignored - leave the value on the stack.
2783 } else { 2792 } else {
2784 CodeForSourcePosition(node->position()); 2793 CodeForSourcePosition(node->position());
2785 if (node->op() == Token::INIT_CONST) { 2794 if (node->op() == Token::INIT_CONST) {
2786 // Dynamic constant initializations must use the function context 2795 // Dynamic constant initializations must use the function context
2787 // and initialize the actual constant declared. Dynamic variable 2796 // and initialize the actual constant declared. Dynamic variable
2788 // initializations are simply assignments and use SetValue. 2797 // initializations are simply assignments and use SetValue.
2789 target.SetValue(CONST_INIT); 2798 target.SetValue(CONST_INIT);
2790 } else { 2799 } else {
2791 target.SetValue(NOT_CONST_INIT); 2800 target.SetValue(NOT_CONST_INIT);
2801 if (node->ends_initialization_block()) {
2802 ASSERT(target.type() == Reference::NAMED ||
2803 target.type() == Reference::KEYED);
2804 // End of initialization block. Revert to fast case.
2805 int stack_position = (target.type() == Reference::NAMED) ? 1 : 2;
2806 frame_->Push(Operand(esp, stack_position * kPointerSize));
2807 __ CallRuntime(Runtime::kToFastProperties, 1);
2808 }
2792 } 2809 }
2793 } 2810 }
2794 } 2811 }
2795 2812
2796 2813
2797 void CodeGenerator::VisitThrow(Throw* node) { 2814 void CodeGenerator::VisitThrow(Throw* node) {
2798 Comment cmnt(masm_, "[ Throw"); 2815 Comment cmnt(masm_, "[ Throw");
2799 CodeForStatement(node); 2816 CodeForStatement(node);
2800 2817
2801 Load(node->exception()); 2818 Load(node->exception());
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after
5447 5464
5448 // Slow-case: Go through the JavaScript implementation. 5465 // Slow-case: Go through the JavaScript implementation.
5449 __ bind(&slow); 5466 __ bind(&slow);
5450 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 5467 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
5451 } 5468 }
5452 5469
5453 5470
5454 #undef __ 5471 #undef __
5455 5472
5456 } } // namespace v8::internal 5473 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698