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

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

Issue 1724753002: [fullcodegen] Implement control flow across do-expressions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 927 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
928 } 928 }
929 929
930 930
931 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { 931 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
932 Comment cmnt(masm_, "[ ForInStatement"); 932 Comment cmnt(masm_, "[ ForInStatement");
933 SetStatementPosition(stmt, SKIP_BREAK); 933 SetStatementPosition(stmt, SKIP_BREAK);
934 934
935 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); 935 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot();
936 936
937 Label loop, exit;
938 ForIn loop_statement(this, stmt);
939 increment_loop_depth();
940
941 // Get the object to enumerate over. 937 // Get the object to enumerate over.
942 SetExpressionAsStatementPosition(stmt->enumerable()); 938 SetExpressionAsStatementPosition(stmt->enumerable());
943 VisitForAccumulatorValue(stmt->enumerable()); 939 VisitForAccumulatorValue(stmt->enumerable());
944 OperandStackDepthIncrement(ForIn::kElementCount); 940 OperandStackDepthIncrement(5);
941
942 Label loop, exit;
943 Iteration loop_statement(this, stmt);
944 increment_loop_depth();
945 945
946 // If the object is null or undefined, skip over the loop, otherwise convert 946 // If the object is null or undefined, skip over the loop, otherwise convert
947 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4. 947 // it to a JS receiver. See ECMA-262 version 5, section 12.6.4.
948 Label convert, done_convert; 948 Label convert, done_convert;
949 __ JumpIfSmi(eax, &convert, Label::kNear); 949 __ JumpIfSmi(eax, &convert, Label::kNear);
950 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx); 950 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx);
951 __ j(above_equal, &done_convert, Label::kNear); 951 __ j(above_equal, &done_convert, Label::kNear);
952 __ cmp(eax, isolate()->factory()->undefined_value()); 952 __ cmp(eax, isolate()->factory()->undefined_value());
953 __ j(equal, &exit); 953 __ j(equal, &exit);
954 __ cmp(eax, isolate()->factory()->null_value()); 954 __ cmp(eax, isolate()->factory()->null_value());
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 // Generate code for going to the next element by incrementing the 1082 // Generate code for going to the next element by incrementing the
1083 // index (smi) stored on top of the stack. 1083 // index (smi) stored on top of the stack.
1084 __ bind(loop_statement.continue_label()); 1084 __ bind(loop_statement.continue_label());
1085 __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1))); 1085 __ add(Operand(esp, 0 * kPointerSize), Immediate(Smi::FromInt(1)));
1086 1086
1087 EmitBackEdgeBookkeeping(stmt, &loop); 1087 EmitBackEdgeBookkeeping(stmt, &loop);
1088 __ jmp(&loop); 1088 __ jmp(&loop);
1089 1089
1090 // Remove the pointers stored on the stack. 1090 // Remove the pointers stored on the stack.
1091 __ bind(loop_statement.break_label()); 1091 __ bind(loop_statement.break_label());
1092 __ add(esp, Immediate(5 * kPointerSize)); 1092 DropOperands(5);
1093 OperandStackDepthDecrement(ForIn::kElementCount);
1094 1093
1095 // Exit and decrement the loop depth. 1094 // Exit and decrement the loop depth.
1096 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 1095 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
1097 __ bind(&exit); 1096 __ bind(&exit);
1098 decrement_loop_depth(); 1097 decrement_loop_depth();
1099 } 1098 }
1100 1099
1101 1100
1102 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, 1101 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
1103 bool pretenure) { 1102 bool pretenure) {
(...skipping 3029 matching lines...) Expand 10 before | Expand all | Expand 10 after
4133 Assembler::target_address_at(call_target_address, 4132 Assembler::target_address_at(call_target_address,
4134 unoptimized_code)); 4133 unoptimized_code));
4135 return OSR_AFTER_STACK_CHECK; 4134 return OSR_AFTER_STACK_CHECK;
4136 } 4135 }
4137 4136
4138 4137
4139 } // namespace internal 4138 } // namespace internal
4140 } // namespace v8 4139 } // namespace v8
4141 4140
4142 #endif // V8_TARGET_ARCH_IA32 4141 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698