OLD | NEW |
---|---|
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 #ifdef DEBUG | 501 #ifdef DEBUG |
502 // Add a label for checking the size of the code used for returning. | 502 // Add a label for checking the size of the code used for returning. |
503 Label check_exit_codesize; | 503 Label check_exit_codesize; |
504 __ bind(&check_exit_codesize); | 504 __ bind(&check_exit_codesize); |
505 #endif | 505 #endif |
506 // Make sure that the constant pool is not emitted inside of the return | 506 // Make sure that the constant pool is not emitted inside of the return |
507 // sequence. | 507 // sequence. |
508 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 508 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
509 int32_t arg_count = info_->scope()->num_parameters() + 1; | 509 int32_t arg_count = info_->scope()->num_parameters() + 1; |
510 int32_t sp_delta = arg_count * kPointerSize; | 510 int32_t sp_delta = arg_count * kPointerSize; |
511 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 511 SetReturnPosition(function()); |
512 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5! | 512 // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5! |
513 PredictableCodeSizeScope predictable(masm_, -1); | 513 PredictableCodeSizeScope predictable(masm_, -1); |
514 __ RecordJSReturn(); | 514 __ RecordJSReturn(); |
515 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 515 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
516 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_); | 516 { ConstantPoolUnavailableScope constant_pool_unavailable(masm_); |
517 __ add(sp, sp, Operand(sp_delta)); | 517 __ add(sp, sp, Operand(sp_delta)); |
518 __ Jump(lr); | 518 __ Jump(lr); |
519 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 519 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
520 } | 520 } |
521 } | 521 } |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1073 patch_site.EmitJumpIfNotSmi(r2, &slow_case); | 1073 patch_site.EmitJumpIfNotSmi(r2, &slow_case); |
1074 | 1074 |
1075 __ cmp(r1, r0); | 1075 __ cmp(r1, r0); |
1076 __ b(ne, &next_test); | 1076 __ b(ne, &next_test); |
1077 __ Drop(1); // Switch value is no longer needed. | 1077 __ Drop(1); // Switch value is no longer needed. |
1078 __ b(clause->body_target()); | 1078 __ b(clause->body_target()); |
1079 __ bind(&slow_case); | 1079 __ bind(&slow_case); |
1080 } | 1080 } |
1081 | 1081 |
1082 // Record position before stub call for type feedback. | 1082 // Record position before stub call for type feedback. |
1083 SetSourcePosition(clause->position()); | 1083 SetExpressionPosition(clause); |
1084 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, | 1084 Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, |
1085 strength(language_mode())).code(); | 1085 strength(language_mode())).code(); |
1086 CallIC(ic, clause->CompareId()); | 1086 CallIC(ic, clause->CompareId()); |
1087 patch_site.EmitPatchInfo(); | 1087 patch_site.EmitPatchInfo(); |
1088 | 1088 |
1089 Label skip; | 1089 Label skip; |
1090 __ b(&skip); | 1090 __ b(&skip); |
1091 PrepareForBailout(clause, TOS_REG); | 1091 PrepareForBailout(clause, TOS_REG); |
1092 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 1092 __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
1093 __ cmp(r0, ip); | 1093 __ cmp(r0, ip); |
(...skipping 27 matching lines...) Expand all Loading... | |
1121 VisitStatements(clause->statements()); | 1121 VisitStatements(clause->statements()); |
1122 } | 1122 } |
1123 | 1123 |
1124 __ bind(nested_statement.break_label()); | 1124 __ bind(nested_statement.break_label()); |
1125 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 1125 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
1126 } | 1126 } |
1127 | 1127 |
1128 | 1128 |
1129 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { | 1129 void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
1130 Comment cmnt(masm_, "[ ForInStatement"); | 1130 Comment cmnt(masm_, "[ ForInStatement"); |
1131 SetStatementPosition(stmt, SKIP_BREAK); | |
1132 | |
1131 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); | 1133 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
1132 SetStatementPosition(stmt); | |
1133 | 1134 |
1134 Label loop, exit; | 1135 Label loop, exit; |
1135 ForIn loop_statement(this, stmt); | 1136 ForIn loop_statement(this, stmt); |
1136 increment_loop_depth(); | 1137 increment_loop_depth(); |
1137 | 1138 |
1138 // Get the object to enumerate over. If the object is null or undefined, skip | 1139 // Get the object to enumerate over. If the object is null or undefined, skip |
1139 // over the loop. See ECMA-262 version 5, section 12.6.4. | 1140 // over the loop. See ECMA-262 version 5, section 12.6.4. |
1140 SetExpressionPosition(stmt->enumerable()); | 1141 SetExpressionAsStatementPosition(stmt->enumerable()); |
1141 VisitForAccumulatorValue(stmt->enumerable()); | 1142 VisitForAccumulatorValue(stmt->enumerable()); |
1142 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 1143 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
1143 __ cmp(r0, ip); | 1144 __ cmp(r0, ip); |
1144 __ b(eq, &exit); | 1145 __ b(eq, &exit); |
1145 Register null_value = r5; | 1146 Register null_value = r5; |
1146 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 1147 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
1147 __ cmp(r0, null_value); | 1148 __ cmp(r0, null_value); |
1148 __ b(eq, &exit); | 1149 __ b(eq, &exit); |
1149 | 1150 |
1150 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); | 1151 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1234 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy | 1235 __ mov(r1, Operand(Smi::FromInt(0))); // Zero indicates proxy |
1235 __ bind(&non_proxy); | 1236 __ bind(&non_proxy); |
1236 __ Push(r1, r0); // Smi and array | 1237 __ Push(r1, r0); // Smi and array |
1237 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); | 1238 __ ldr(r1, FieldMemOperand(r0, FixedArray::kLengthOffset)); |
1238 __ mov(r0, Operand(Smi::FromInt(0))); | 1239 __ mov(r0, Operand(Smi::FromInt(0))); |
1239 __ Push(r1, r0); // Fixed array length (as smi) and initial index. | 1240 __ Push(r1, r0); // Fixed array length (as smi) and initial index. |
1240 | 1241 |
1241 // Generate code for doing the condition check. | 1242 // Generate code for doing the condition check. |
1242 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); | 1243 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
1243 __ bind(&loop); | 1244 __ bind(&loop); |
1244 SetExpressionPosition(stmt->each()); | 1245 SetExpressionAsStatementPosition(stmt->each()); |
1245 | 1246 |
1246 // Load the current count to r0, load the length to r1. | 1247 // Load the current count to r0, load the length to r1. |
1247 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize)); | 1248 __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize)); |
1248 __ cmp(r0, r1); // Compare to the array length. | 1249 __ cmp(r0, r1); // Compare to the array length. |
1249 __ b(hs, loop_statement.break_label()); | 1250 __ b(hs, loop_statement.break_label()); |
1250 | 1251 |
1251 // Get the current entry of the array into register r3. | 1252 // Get the current entry of the array into register r3. |
1252 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); | 1253 __ ldr(r2, MemOperand(sp, 2 * kPointerSize)); |
1253 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 1254 __ add(r2, r2, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
1254 __ ldr(r3, MemOperand::PointerAddressFromSmiKey(r2, r0)); | 1255 __ ldr(r3, MemOperand::PointerAddressFromSmiKey(r2, r0)); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1484 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 1485 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
1485 } | 1486 } |
1486 } | 1487 } |
1487 __ jmp(done); | 1488 __ jmp(done); |
1488 } | 1489 } |
1489 } | 1490 } |
1490 | 1491 |
1491 | 1492 |
1492 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { | 1493 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
1493 // Record position before possible IC call. | 1494 // Record position before possible IC call. |
1494 SetSourcePosition(proxy->position()); | 1495 SetExpressionPosition(proxy); |
1495 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); | 1496 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); |
1496 Variable* var = proxy->var(); | 1497 Variable* var = proxy->var(); |
1497 | 1498 |
1498 // Three cases: global variables, lookup variables, and all other types of | 1499 // Three cases: global variables, lookup variables, and all other types of |
1499 // variables. | 1500 // variables. |
1500 switch (var->location()) { | 1501 switch (var->location()) { |
1501 case Variable::UNALLOCATED: { | 1502 case Variable::UNALLOCATED: { |
1502 Comment cmnt(masm_, "[ Global variable"); | 1503 Comment cmnt(masm_, "[ Global variable"); |
1503 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1504 __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1504 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); | 1505 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1979 } else { | 1980 } else { |
1980 context()->Plug(r0); | 1981 context()->Plug(r0); |
1981 } | 1982 } |
1982 } | 1983 } |
1983 | 1984 |
1984 | 1985 |
1985 void FullCodeGenerator::VisitAssignment(Assignment* expr) { | 1986 void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
1986 DCHECK(expr->target()->IsValidReferenceExpression()); | 1987 DCHECK(expr->target()->IsValidReferenceExpression()); |
1987 | 1988 |
1988 Comment cmnt(masm_, "[ Assignment"); | 1989 Comment cmnt(masm_, "[ Assignment"); |
1990 SetExpressionPosition(expr, INSERT_BREAK); | |
1989 | 1991 |
1990 Property* property = expr->target()->AsProperty(); | 1992 Property* property = expr->target()->AsProperty(); |
1991 LhsKind assign_type = Property::GetAssignType(property); | 1993 LhsKind assign_type = Property::GetAssignType(property); |
1992 | 1994 |
1993 // Evaluate LHS expression. | 1995 // Evaluate LHS expression. |
1994 switch (assign_type) { | 1996 switch (assign_type) { |
1995 case VARIABLE: | 1997 case VARIABLE: |
1996 // Nothing to do here. | 1998 // Nothing to do here. |
1997 break; | 1999 break; |
1998 case NAMED_PROPERTY: | 2000 case NAMED_PROPERTY: |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2072 EmitKeyedPropertyLoad(property); | 2074 EmitKeyedPropertyLoad(property); |
2073 PrepareForBailoutForId(property->LoadId(), TOS_REG); | 2075 PrepareForBailoutForId(property->LoadId(), TOS_REG); |
2074 break; | 2076 break; |
2075 } | 2077 } |
2076 } | 2078 } |
2077 | 2079 |
2078 Token::Value op = expr->binary_op(); | 2080 Token::Value op = expr->binary_op(); |
2079 __ push(r0); // Left operand goes on the stack. | 2081 __ push(r0); // Left operand goes on the stack. |
2080 VisitForAccumulatorValue(expr->value()); | 2082 VisitForAccumulatorValue(expr->value()); |
2081 | 2083 |
2082 SetSourcePosition(expr->position() + 1); | |
2083 AccumulatorValueContext context(this); | 2084 AccumulatorValueContext context(this); |
2084 if (ShouldInlineSmiCase(op)) { | 2085 if (ShouldInlineSmiCase(op)) { |
2085 EmitInlineSmiBinaryOp(expr->binary_operation(), | 2086 EmitInlineSmiBinaryOp(expr->binary_operation(), |
2086 op, | 2087 op, |
2087 expr->target(), | 2088 expr->target(), |
2088 expr->value()); | 2089 expr->value()); |
2089 } else { | 2090 } else { |
2090 EmitBinaryOp(expr->binary_operation(), op); | 2091 EmitBinaryOp(expr->binary_operation(), op); |
2091 } | 2092 } |
2092 | 2093 |
2093 // Deoptimization point in case the binary operation may have side effects. | 2094 // Deoptimization point in case the binary operation may have side effects. |
2094 PrepareForBailout(expr->binary_operation(), TOS_REG); | 2095 PrepareForBailout(expr->binary_operation(), TOS_REG); |
2095 } else { | 2096 } else { |
2096 VisitForAccumulatorValue(expr->value()); | 2097 VisitForAccumulatorValue(expr->value()); |
2097 } | 2098 } |
2098 | 2099 |
2099 // Record source position before possible IC call. | 2100 SetExpressionPosition(expr); |
2100 SetSourcePosition(expr->position()); | |
2101 | 2101 |
2102 // Store the value. | 2102 // Store the value. |
2103 switch (assign_type) { | 2103 switch (assign_type) { |
2104 case VARIABLE: | 2104 case VARIABLE: |
2105 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), | 2105 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), |
2106 expr->op(), expr->AssignmentSlot()); | 2106 expr->op(), expr->AssignmentSlot()); |
2107 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2107 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
2108 context()->Plug(r0); | 2108 context()->Plug(r0); |
2109 break; | 2109 break; |
2110 case NAMED_PROPERTY: | 2110 case NAMED_PROPERTY: |
2111 EmitNamedPropertyAssignment(expr); | 2111 EmitNamedPropertyAssignment(expr); |
2112 break; | 2112 break; |
2113 case NAMED_SUPER_PROPERTY: | 2113 case NAMED_SUPER_PROPERTY: |
2114 EmitNamedSuperPropertyStore(property); | 2114 EmitNamedSuperPropertyStore(property); |
2115 context()->Plug(r0); | 2115 context()->Plug(r0); |
2116 break; | 2116 break; |
2117 case KEYED_SUPER_PROPERTY: | 2117 case KEYED_SUPER_PROPERTY: |
2118 EmitKeyedSuperPropertyStore(property); | 2118 EmitKeyedSuperPropertyStore(property); |
2119 context()->Plug(r0); | 2119 context()->Plug(r0); |
2120 break; | 2120 break; |
2121 case KEYED_PROPERTY: | 2121 case KEYED_PROPERTY: |
2122 EmitKeyedPropertyAssignment(expr); | 2122 EmitKeyedPropertyAssignment(expr); |
2123 break; | 2123 break; |
2124 } | 2124 } |
2125 } | 2125 } |
2126 | 2126 |
2127 | 2127 |
2128 void FullCodeGenerator::VisitYield(Yield* expr) { | 2128 void FullCodeGenerator::VisitYield(Yield* expr) { |
2129 Comment cmnt(masm_, "[ Yield"); | 2129 Comment cmnt(masm_, "[ Yield"); |
2130 SetExpressionPosition(expr); | |
ulan
2015/07/06 09:24:18
Why we don't insert break here?
Yang
2015/07/06 10:05:08
Because EmitReturnSequence emits a return, which i
| |
2131 | |
2130 // Evaluate yielded value first; the initial iterator definition depends on | 2132 // Evaluate yielded value first; the initial iterator definition depends on |
2131 // this. It stays on the stack while we update the iterator. | 2133 // this. It stays on the stack while we update the iterator. |
2132 VisitForStackValue(expr->expression()); | 2134 VisitForStackValue(expr->expression()); |
2133 | 2135 |
2134 switch (expr->yield_kind()) { | 2136 switch (expr->yield_kind()) { |
2135 case Yield::kSuspend: | 2137 case Yield::kSuspend: |
2136 // Pop value from top-of-stack slot; box result into result register. | 2138 // Pop value from top-of-stack slot; box result into result register. |
2137 EmitCreateIteratorResult(false); | 2139 EmitCreateIteratorResult(false); |
2138 __ push(result_register()); | 2140 __ push(result_register()); |
2139 // Fall through. | 2141 // Fall through. |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2415 FieldMemOperand(r0, JSGeneratorObject::kResultDonePropertyOffset)); | 2417 FieldMemOperand(r0, JSGeneratorObject::kResultDonePropertyOffset)); |
2416 | 2418 |
2417 // Only the value field needs a write barrier, as the other values are in the | 2419 // Only the value field needs a write barrier, as the other values are in the |
2418 // root set. | 2420 // root set. |
2419 __ RecordWriteField(r0, JSGeneratorObject::kResultValuePropertyOffset, | 2421 __ RecordWriteField(r0, JSGeneratorObject::kResultValuePropertyOffset, |
2420 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); | 2422 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); |
2421 } | 2423 } |
2422 | 2424 |
2423 | 2425 |
2424 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2426 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2425 SetSourcePosition(prop->position()); | 2427 SetExpressionPosition(prop); |
2426 Literal* key = prop->key()->AsLiteral(); | 2428 Literal* key = prop->key()->AsLiteral(); |
2427 DCHECK(!prop->IsSuperAccess()); | 2429 DCHECK(!prop->IsSuperAccess()); |
2428 | 2430 |
2429 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); | 2431 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); |
2430 __ mov(LoadDescriptor::SlotRegister(), | 2432 __ mov(LoadDescriptor::SlotRegister(), |
2431 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2433 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2432 CallLoadIC(NOT_CONTEXTUAL, language_mode()); | 2434 CallLoadIC(NOT_CONTEXTUAL, language_mode()); |
2433 } | 2435 } |
2434 | 2436 |
2435 | 2437 |
2436 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2438 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2437 // Stack: receiver, home_object. | 2439 // Stack: receiver, home_object. |
2438 SetSourcePosition(prop->position()); | 2440 SetExpressionPosition(prop); |
2439 Literal* key = prop->key()->AsLiteral(); | 2441 Literal* key = prop->key()->AsLiteral(); |
2440 DCHECK(!key->value()->IsSmi()); | 2442 DCHECK(!key->value()->IsSmi()); |
2441 DCHECK(prop->IsSuperAccess()); | 2443 DCHECK(prop->IsSuperAccess()); |
2442 | 2444 |
2443 __ Push(key->value()); | 2445 __ Push(key->value()); |
2444 __ Push(Smi::FromInt(language_mode())); | 2446 __ Push(Smi::FromInt(language_mode())); |
2445 __ CallRuntime(Runtime::kLoadFromSuper, 4); | 2447 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
2446 } | 2448 } |
2447 | 2449 |
2448 | 2450 |
2449 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2451 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2450 SetSourcePosition(prop->position()); | 2452 SetExpressionPosition(prop); |
2451 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); | 2453 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); |
2452 __ mov(LoadDescriptor::SlotRegister(), | 2454 __ mov(LoadDescriptor::SlotRegister(), |
2453 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2455 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2454 CallIC(ic); | 2456 CallIC(ic); |
2455 } | 2457 } |
2456 | 2458 |
2457 | 2459 |
2458 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2460 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2459 // Stack: receiver, home_object, key. | 2461 // Stack: receiver, home_object, key. |
2462 SetExpressionPosition(prop); | |
2460 __ Push(Smi::FromInt(language_mode())); | 2463 __ Push(Smi::FromInt(language_mode())); |
2461 SetSourcePosition(prop->position()); | |
2462 | |
2463 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | 2464 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2464 } | 2465 } |
2465 | 2466 |
2466 | 2467 |
2467 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2468 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2468 Token::Value op, | 2469 Token::Value op, |
2469 Expression* left_expr, | 2470 Expression* left_expr, |
2470 Expression* right_expr) { | 2471 Expression* right_expr) { |
2471 Label done, smi_case, stub_call; | 2472 Label done, smi_case, stub_call; |
2472 | 2473 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2821 if (is_strict(language_mode())) { | 2822 if (is_strict(language_mode())) { |
2822 __ CallRuntime(Runtime::kThrowConstAssignError, 0); | 2823 __ CallRuntime(Runtime::kThrowConstAssignError, 0); |
2823 } | 2824 } |
2824 // Silently ignore store in sloppy mode. | 2825 // Silently ignore store in sloppy mode. |
2825 } | 2826 } |
2826 } | 2827 } |
2827 | 2828 |
2828 | 2829 |
2829 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2830 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
2830 // Assignment to a property, using a named store IC. | 2831 // Assignment to a property, using a named store IC. |
2832 SetExpressionPosition(expr); | |
ulan
2015/07/06 09:24:18
Why we don't insert break here?
Yang
2015/07/06 10:05:08
Actually we don't need this at all. The caller alr
| |
2831 Property* prop = expr->target()->AsProperty(); | 2833 Property* prop = expr->target()->AsProperty(); |
2832 DCHECK(prop != NULL); | 2834 DCHECK(prop != NULL); |
2833 DCHECK(prop->key()->IsLiteral()); | 2835 DCHECK(prop->key()->IsLiteral()); |
2834 | 2836 |
2835 // Record source code position before IC call. | |
2836 SetSourcePosition(expr->position()); | |
2837 __ mov(StoreDescriptor::NameRegister(), | 2837 __ mov(StoreDescriptor::NameRegister(), |
2838 Operand(prop->key()->AsLiteral()->value())); | 2838 Operand(prop->key()->AsLiteral()->value())); |
2839 __ pop(StoreDescriptor::ReceiverRegister()); | 2839 __ pop(StoreDescriptor::ReceiverRegister()); |
2840 if (FLAG_vector_stores) { | 2840 if (FLAG_vector_stores) { |
2841 EmitLoadStoreICSlot(expr->AssignmentSlot()); | 2841 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
2842 CallStoreIC(); | 2842 CallStoreIC(); |
2843 } else { | 2843 } else { |
2844 CallStoreIC(expr->AssignmentFeedbackId()); | 2844 CallStoreIC(expr->AssignmentFeedbackId()); |
2845 } | 2845 } |
2846 | 2846 |
(...skipping 27 matching lines...) Expand all Loading... | |
2874 __ Push(r0); | 2874 __ Push(r0); |
2875 __ CallRuntime( | 2875 __ CallRuntime( |
2876 (is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 2876 (is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
2877 : Runtime::kStoreKeyedToSuper_Sloppy), | 2877 : Runtime::kStoreKeyedToSuper_Sloppy), |
2878 4); | 2878 4); |
2879 } | 2879 } |
2880 | 2880 |
2881 | 2881 |
2882 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2882 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
2883 // Assignment to a property, using a keyed store IC. | 2883 // Assignment to a property, using a keyed store IC. |
2884 SetExpressionPosition(expr); | |
2884 | 2885 |
2885 // Record source code position before IC call. | |
2886 SetSourcePosition(expr->position()); | |
2887 __ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister()); | 2886 __ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister()); |
2888 DCHECK(StoreDescriptor::ValueRegister().is(r0)); | 2887 DCHECK(StoreDescriptor::ValueRegister().is(r0)); |
2889 | 2888 |
2890 Handle<Code> ic = | 2889 Handle<Code> ic = |
2891 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | 2890 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); |
2892 if (FLAG_vector_stores) { | 2891 if (FLAG_vector_stores) { |
2893 EmitLoadStoreICSlot(expr->AssignmentSlot()); | 2892 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
2894 CallIC(ic); | 2893 CallIC(ic); |
2895 } else { | 2894 } else { |
2896 CallIC(ic, expr->AssignmentFeedbackId()); | 2895 CallIC(ic, expr->AssignmentFeedbackId()); |
2897 } | 2896 } |
2898 | 2897 |
2899 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2898 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
2900 context()->Plug(r0); | 2899 context()->Plug(r0); |
2901 } | 2900 } |
2902 | 2901 |
2903 | 2902 |
2904 void FullCodeGenerator::VisitProperty(Property* expr) { | 2903 void FullCodeGenerator::VisitProperty(Property* expr) { |
2905 Comment cmnt(masm_, "[ Property"); | 2904 Comment cmnt(masm_, "[ Property"); |
2905 SetExpressionPosition(expr); | |
2906 | |
2906 Expression* key = expr->key(); | 2907 Expression* key = expr->key(); |
2907 | 2908 |
2908 if (key->IsPropertyName()) { | 2909 if (key->IsPropertyName()) { |
2909 if (!expr->IsSuperAccess()) { | 2910 if (!expr->IsSuperAccess()) { |
2910 VisitForAccumulatorValue(expr->obj()); | 2911 VisitForAccumulatorValue(expr->obj()); |
2911 __ Move(LoadDescriptor::ReceiverRegister(), r0); | 2912 __ Move(LoadDescriptor::ReceiverRegister(), r0); |
2912 EmitNamedPropertyLoad(expr); | 2913 EmitNamedPropertyLoad(expr); |
2913 } else { | 2914 } else { |
2914 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2915 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
2915 VisitForStackValue( | 2916 VisitForStackValue( |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2978 | 2979 |
2979 EmitCall(expr, call_type); | 2980 EmitCall(expr, call_type); |
2980 } | 2981 } |
2981 | 2982 |
2982 | 2983 |
2983 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { | 2984 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { |
2984 Expression* callee = expr->expression(); | 2985 Expression* callee = expr->expression(); |
2985 DCHECK(callee->IsProperty()); | 2986 DCHECK(callee->IsProperty()); |
2986 Property* prop = callee->AsProperty(); | 2987 Property* prop = callee->AsProperty(); |
2987 DCHECK(prop->IsSuperAccess()); | 2988 DCHECK(prop->IsSuperAccess()); |
2989 SetExpressionPosition(prop); | |
2988 | 2990 |
2989 SetSourcePosition(prop->position()); | |
2990 Literal* key = prop->key()->AsLiteral(); | 2991 Literal* key = prop->key()->AsLiteral(); |
2991 DCHECK(!key->value()->IsSmi()); | 2992 DCHECK(!key->value()->IsSmi()); |
2992 // Load the function from the receiver. | 2993 // Load the function from the receiver. |
2993 const Register scratch = r1; | 2994 const Register scratch = r1; |
2994 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2995 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2995 VisitForStackValue(super_ref->home_object()); | 2996 VisitForStackValue(super_ref->home_object()); |
2996 VisitForAccumulatorValue(super_ref->this_var()); | 2997 VisitForAccumulatorValue(super_ref->this_var()); |
2997 __ Push(r0); | 2998 __ Push(r0); |
2998 __ Push(r0); | 2999 __ Push(r0); |
2999 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); | 3000 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3043 EmitCall(expr, CallICState::METHOD); | 3044 EmitCall(expr, CallICState::METHOD); |
3044 } | 3045 } |
3045 | 3046 |
3046 | 3047 |
3047 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 3048 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
3048 Expression* callee = expr->expression(); | 3049 Expression* callee = expr->expression(); |
3049 DCHECK(callee->IsProperty()); | 3050 DCHECK(callee->IsProperty()); |
3050 Property* prop = callee->AsProperty(); | 3051 Property* prop = callee->AsProperty(); |
3051 DCHECK(prop->IsSuperAccess()); | 3052 DCHECK(prop->IsSuperAccess()); |
3052 | 3053 |
3053 SetSourcePosition(prop->position()); | 3054 SetExpressionPosition(prop); |
3054 // Load the function from the receiver. | 3055 // Load the function from the receiver. |
3055 const Register scratch = r1; | 3056 const Register scratch = r1; |
3056 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 3057 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
3057 VisitForStackValue(super_ref->home_object()); | 3058 VisitForStackValue(super_ref->home_object()); |
3058 VisitForAccumulatorValue(super_ref->this_var()); | 3059 VisitForAccumulatorValue(super_ref->this_var()); |
3059 __ Push(r0); | 3060 __ Push(r0); |
3060 __ Push(r0); | 3061 __ Push(r0); |
3061 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); | 3062 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); |
3062 __ Push(scratch); | 3063 __ Push(scratch); |
3063 VisitForStackValue(prop->key()); | 3064 VisitForStackValue(prop->key()); |
(...skipping 15 matching lines...) Expand all Loading... | |
3079 // - target function | 3080 // - target function |
3080 // - this (receiver) | 3081 // - this (receiver) |
3081 EmitCall(expr, CallICState::METHOD); | 3082 EmitCall(expr, CallICState::METHOD); |
3082 } | 3083 } |
3083 | 3084 |
3084 | 3085 |
3085 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 3086 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
3086 // Load the arguments. | 3087 // Load the arguments. |
3087 ZoneList<Expression*>* args = expr->arguments(); | 3088 ZoneList<Expression*>* args = expr->arguments(); |
3088 int arg_count = args->length(); | 3089 int arg_count = args->length(); |
3089 { PreservePositionScope scope(masm()->positions_recorder()); | 3090 for (int i = 0; i < arg_count; i++) { |
3090 for (int i = 0; i < arg_count; i++) { | 3091 VisitForStackValue(args->at(i)); |
3091 VisitForStackValue(args->at(i)); | |
3092 } | |
3093 } | 3092 } |
3094 | 3093 |
3095 // Record source position of the IC call. | 3094 SetExpressionPosition(expr); |
3096 SetSourcePosition(expr->position()); | |
3097 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 3095 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
3098 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 3096 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
3099 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3097 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3100 // Don't assign a type feedback id to the IC, since type feedback is provided | 3098 // Don't assign a type feedback id to the IC, since type feedback is provided |
3101 // by the vector above. | 3099 // by the vector above. |
3102 CallIC(ic); | 3100 CallIC(ic); |
3103 | 3101 |
3104 RecordJSReturnSite(expr); | 3102 RecordJSReturnSite(expr); |
3105 // Restore context register. | 3103 // Restore context register. |
3106 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3104 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3145 | 3143 |
3146 EmitVariableAssignment(this_var, Token::INIT_CONST, slot); | 3144 EmitVariableAssignment(this_var, Token::INIT_CONST, slot); |
3147 } | 3145 } |
3148 | 3146 |
3149 | 3147 |
3150 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 3148 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
3151 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 3149 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
3152 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 3150 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
3153 if (callee->var()->IsLookupSlot()) { | 3151 if (callee->var()->IsLookupSlot()) { |
3154 Label slow, done; | 3152 Label slow, done; |
3155 SetSourcePosition(callee->position()); | 3153 SetExpressionPosition(callee); |
3156 { | 3154 // Generate code for loading from variables potentially shadowed |
3157 PreservePositionScope scope(masm()->positions_recorder()); | 3155 // by eval-introduced variables. |
3158 // Generate code for loading from variables potentially shadowed | 3156 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); |
3159 // by eval-introduced variables. | |
3160 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); | |
3161 } | |
3162 | 3157 |
3163 __ bind(&slow); | 3158 __ bind(&slow); |
3164 // Call the runtime to find the function to call (returned in r0) | 3159 // Call the runtime to find the function to call (returned in r0) |
3165 // and the object holding it (returned in edx). | 3160 // and the object holding it (returned in edx). |
3166 DCHECK(!context_register().is(r2)); | 3161 DCHECK(!context_register().is(r2)); |
3167 __ mov(r2, Operand(callee->name())); | 3162 __ mov(r2, Operand(callee->name())); |
3168 __ Push(context_register(), r2); | 3163 __ Push(context_register(), r2); |
3169 __ CallRuntime(Runtime::kLoadLookupSlot, 2); | 3164 __ CallRuntime(Runtime::kLoadLookupSlot, 2); |
3170 __ Push(r0, r1); // Function, receiver. | 3165 __ Push(r0, r1); // Function, receiver. |
3171 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); | 3166 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3205 Expression* callee = expr->expression(); | 3200 Expression* callee = expr->expression(); |
3206 Call::CallType call_type = expr->GetCallType(isolate()); | 3201 Call::CallType call_type = expr->GetCallType(isolate()); |
3207 | 3202 |
3208 if (call_type == Call::POSSIBLY_EVAL_CALL) { | 3203 if (call_type == Call::POSSIBLY_EVAL_CALL) { |
3209 // In a call to eval, we first call | 3204 // In a call to eval, we first call |
3210 // RuntimeHidden_asResolvePossiblyDirectEval to resolve the function we need | 3205 // RuntimeHidden_asResolvePossiblyDirectEval to resolve the function we need |
3211 // to call. Then we call the resolved function using the given arguments. | 3206 // to call. Then we call the resolved function using the given arguments. |
3212 ZoneList<Expression*>* args = expr->arguments(); | 3207 ZoneList<Expression*>* args = expr->arguments(); |
3213 int arg_count = args->length(); | 3208 int arg_count = args->length(); |
3214 | 3209 |
3215 { PreservePositionScope pos_scope(masm()->positions_recorder()); | 3210 PushCalleeAndWithBaseObject(expr); |
3216 PushCalleeAndWithBaseObject(expr); | |
3217 | 3211 |
3218 // Push the arguments. | 3212 // Push the arguments. |
3219 for (int i = 0; i < arg_count; i++) { | 3213 for (int i = 0; i < arg_count; i++) { |
3220 VisitForStackValue(args->at(i)); | 3214 VisitForStackValue(args->at(i)); |
3221 } | |
3222 | |
3223 // Push a copy of the function (found below the arguments) and | |
3224 // resolve eval. | |
3225 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | |
3226 __ push(r1); | |
3227 EmitResolvePossiblyDirectEval(arg_count); | |
3228 | |
3229 // Touch up the stack with the resolved function. | |
3230 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | |
3231 | |
3232 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | |
3233 } | 3215 } |
3234 | 3216 |
3217 // Push a copy of the function (found below the arguments) and | |
3218 // resolve eval. | |
3219 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | |
3220 __ push(r1); | |
3221 EmitResolvePossiblyDirectEval(arg_count); | |
3222 | |
3223 // Touch up the stack with the resolved function. | |
3224 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | |
3225 | |
3226 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); | |
3227 | |
3235 // Record source position for debugger. | 3228 // Record source position for debugger. |
3236 SetSourcePosition(expr->position()); | 3229 SetExpressionPosition(expr); |
3237 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 3230 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
3238 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3231 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
3239 __ CallStub(&stub); | 3232 __ CallStub(&stub); |
3240 RecordJSReturnSite(expr); | 3233 RecordJSReturnSite(expr); |
3241 // Restore context register. | 3234 // Restore context register. |
3242 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3235 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3243 context()->DropAndPlug(1, r0); | 3236 context()->DropAndPlug(1, r0); |
3244 } else if (call_type == Call::GLOBAL_CALL) { | 3237 } else if (call_type == Call::GLOBAL_CALL) { |
3245 EmitCallWithLoadIC(expr); | 3238 EmitCallWithLoadIC(expr); |
3246 | 3239 |
3247 } else if (call_type == Call::LOOKUP_SLOT_CALL) { | 3240 } else if (call_type == Call::LOOKUP_SLOT_CALL) { |
3248 // Call to a lookup slot (dynamically introduced variable). | 3241 // Call to a lookup slot (dynamically introduced variable). |
3249 PushCalleeAndWithBaseObject(expr); | 3242 PushCalleeAndWithBaseObject(expr); |
3250 EmitCall(expr); | 3243 EmitCall(expr); |
3251 } else if (call_type == Call::PROPERTY_CALL) { | 3244 } else if (call_type == Call::PROPERTY_CALL) { |
3252 Property* property = callee->AsProperty(); | 3245 Property* property = callee->AsProperty(); |
3253 bool is_named_call = property->key()->IsPropertyName(); | 3246 bool is_named_call = property->key()->IsPropertyName(); |
3254 if (property->IsSuperAccess()) { | 3247 if (property->IsSuperAccess()) { |
3255 if (is_named_call) { | 3248 if (is_named_call) { |
3256 EmitSuperCallWithLoadIC(expr); | 3249 EmitSuperCallWithLoadIC(expr); |
3257 } else { | 3250 } else { |
3258 EmitKeyedSuperCallWithLoadIC(expr); | 3251 EmitKeyedSuperCallWithLoadIC(expr); |
3259 } | 3252 } |
3260 } else { | 3253 } else { |
3261 { | |
3262 PreservePositionScope scope(masm()->positions_recorder()); | |
3263 VisitForStackValue(property->obj()); | 3254 VisitForStackValue(property->obj()); |
3264 } | |
3265 if (is_named_call) { | 3255 if (is_named_call) { |
3266 EmitCallWithLoadIC(expr); | 3256 EmitCallWithLoadIC(expr); |
3267 } else { | 3257 } else { |
3268 EmitKeyedCallWithLoadIC(expr, property->key()); | 3258 EmitKeyedCallWithLoadIC(expr, property->key()); |
3269 } | 3259 } |
3270 } | 3260 } |
3271 } else if (call_type == Call::SUPER_CALL) { | 3261 } else if (call_type == Call::SUPER_CALL) { |
3272 EmitSuperConstructorCall(expr); | 3262 EmitSuperConstructorCall(expr); |
3273 } else { | 3263 } else { |
3274 DCHECK(call_type == Call::OTHER_CALL); | 3264 DCHECK(call_type == Call::OTHER_CALL); |
3275 // Call to an arbitrary expression not handled specially above. | 3265 // Call to an arbitrary expression not handled specially above. |
3276 { PreservePositionScope scope(masm()->positions_recorder()); | 3266 VisitForStackValue(callee); |
3277 VisitForStackValue(callee); | |
3278 } | |
3279 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 3267 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
3280 __ push(r1); | 3268 __ push(r1); |
3281 // Emit function call. | 3269 // Emit function call. |
3282 EmitCall(expr); | 3270 EmitCall(expr); |
3283 } | 3271 } |
3284 | 3272 |
3285 #ifdef DEBUG | 3273 #ifdef DEBUG |
3286 // RecordJSReturnSite should have been called. | 3274 // RecordJSReturnSite should have been called. |
3287 DCHECK(expr->return_is_recorded_); | 3275 DCHECK(expr->return_is_recorded_); |
3288 #endif | 3276 #endif |
(...skipping 14 matching lines...) Expand all Loading... | |
3303 | 3291 |
3304 // Push the arguments ("left-to-right") on the stack. | 3292 // Push the arguments ("left-to-right") on the stack. |
3305 ZoneList<Expression*>* args = expr->arguments(); | 3293 ZoneList<Expression*>* args = expr->arguments(); |
3306 int arg_count = args->length(); | 3294 int arg_count = args->length(); |
3307 for (int i = 0; i < arg_count; i++) { | 3295 for (int i = 0; i < arg_count; i++) { |
3308 VisitForStackValue(args->at(i)); | 3296 VisitForStackValue(args->at(i)); |
3309 } | 3297 } |
3310 | 3298 |
3311 // Call the construct call builtin that handles allocation and | 3299 // Call the construct call builtin that handles allocation and |
3312 // constructor invocation. | 3300 // constructor invocation. |
3313 SetSourcePosition(expr->position()); | 3301 SetExpressionPosition(expr); |
3314 | 3302 |
3315 // Load function and argument count into r1 and r0. | 3303 // Load function and argument count into r1 and r0. |
3316 __ mov(r0, Operand(arg_count)); | 3304 __ mov(r0, Operand(arg_count)); |
3317 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 3305 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
3318 | 3306 |
3319 // Record call targets in unoptimized code. | 3307 // Record call targets in unoptimized code. |
3320 if (FLAG_pretenuring_call_new) { | 3308 if (FLAG_pretenuring_call_new) { |
3321 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3309 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
3322 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3310 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
3323 expr->CallNewFeedbackSlot().ToInt() + 1); | 3311 expr->CallNewFeedbackSlot().ToInt() + 1); |
(...skipping 22 matching lines...) Expand all Loading... | |
3346 | 3334 |
3347 // Push the arguments ("left-to-right") on the stack. | 3335 // Push the arguments ("left-to-right") on the stack. |
3348 ZoneList<Expression*>* args = expr->arguments(); | 3336 ZoneList<Expression*>* args = expr->arguments(); |
3349 int arg_count = args->length(); | 3337 int arg_count = args->length(); |
3350 for (int i = 0; i < arg_count; i++) { | 3338 for (int i = 0; i < arg_count; i++) { |
3351 VisitForStackValue(args->at(i)); | 3339 VisitForStackValue(args->at(i)); |
3352 } | 3340 } |
3353 | 3341 |
3354 // Call the construct call builtin that handles allocation and | 3342 // Call the construct call builtin that handles allocation and |
3355 // constructor invocation. | 3343 // constructor invocation. |
3356 SetSourcePosition(expr->position()); | 3344 SetExpressionPosition(expr); |
3357 | 3345 |
3358 // Load function and argument count into r1 and r0. | 3346 // Load function and argument count into r1 and r0. |
3359 __ mov(r0, Operand(arg_count)); | 3347 __ mov(r0, Operand(arg_count)); |
3360 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 3348 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
3361 | 3349 |
3362 // Record call targets in unoptimized code. | 3350 // Record call targets in unoptimized code. |
3363 if (FLAG_pretenuring_call_new) { | 3351 if (FLAG_pretenuring_call_new) { |
3364 UNREACHABLE(); | 3352 UNREACHABLE(); |
3365 /* TODO(dslomov): support pretenuring. | 3353 /* TODO(dslomov): support pretenuring. |
3366 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3354 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4725 __ mov(LoadDescriptor::SlotRegister(), | 4713 __ mov(LoadDescriptor::SlotRegister(), |
4726 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4714 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4727 CallLoadIC(NOT_CONTEXTUAL); | 4715 CallLoadIC(NOT_CONTEXTUAL); |
4728 } | 4716 } |
4729 | 4717 |
4730 | 4718 |
4731 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4719 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4732 ZoneList<Expression*>* args = expr->arguments(); | 4720 ZoneList<Expression*>* args = expr->arguments(); |
4733 int arg_count = args->length(); | 4721 int arg_count = args->length(); |
4734 | 4722 |
4735 // Record source position of the IC call. | 4723 SetExpressionPosition(expr); |
4736 SetSourcePosition(expr->position()); | |
4737 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4724 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4738 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4725 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
4739 __ CallStub(&stub); | 4726 __ CallStub(&stub); |
4740 } | 4727 } |
4741 | 4728 |
4742 | 4729 |
4743 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4730 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4744 ZoneList<Expression*>* args = expr->arguments(); | 4731 ZoneList<Expression*>* args = expr->arguments(); |
4745 int arg_count = args->length(); | 4732 int arg_count = args->length(); |
4746 | 4733 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4904 default: | 4891 default: |
4905 UNREACHABLE(); | 4892 UNREACHABLE(); |
4906 } | 4893 } |
4907 } | 4894 } |
4908 | 4895 |
4909 | 4896 |
4910 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 4897 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
4911 DCHECK(expr->expression()->IsValidReferenceExpression()); | 4898 DCHECK(expr->expression()->IsValidReferenceExpression()); |
4912 | 4899 |
4913 Comment cmnt(masm_, "[ CountOperation"); | 4900 Comment cmnt(masm_, "[ CountOperation"); |
4914 SetSourcePosition(expr->position()); | |
4915 | 4901 |
4916 Property* prop = expr->expression()->AsProperty(); | 4902 Property* prop = expr->expression()->AsProperty(); |
4917 LhsKind assign_type = Property::GetAssignType(prop); | 4903 LhsKind assign_type = Property::GetAssignType(prop); |
4918 | 4904 |
4919 // Evaluate expression and get value. | 4905 // Evaluate expression and get value. |
4920 if (assign_type == VARIABLE) { | 4906 if (assign_type == VARIABLE) { |
4921 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); | 4907 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); |
4922 AccumulatorValueContext context(this); | 4908 AccumulatorValueContext context(this); |
4923 EmitVariableLoad(expr->expression()->AsVariableProxy()); | 4909 EmitVariableLoad(expr->expression()->AsVariableProxy()); |
4924 } else { | 4910 } else { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5060 break; | 5046 break; |
5061 } | 5047 } |
5062 } | 5048 } |
5063 } | 5049 } |
5064 | 5050 |
5065 | 5051 |
5066 __ bind(&stub_call); | 5052 __ bind(&stub_call); |
5067 __ mov(r1, r0); | 5053 __ mov(r1, r0); |
5068 __ mov(r0, Operand(Smi::FromInt(count_value))); | 5054 __ mov(r0, Operand(Smi::FromInt(count_value))); |
5069 | 5055 |
5070 // Record position before stub call. | 5056 SetExpressionPosition(expr); |
5071 SetSourcePosition(expr->position()); | |
5072 | 5057 |
5073 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD, | 5058 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD, |
5074 strength(language_mode())).code(); | 5059 strength(language_mode())).code(); |
5075 CallIC(code, expr->CountBinOpFeedbackId()); | 5060 CallIC(code, expr->CountBinOpFeedbackId()); |
5076 patch_site.EmitPatchInfo(); | 5061 patch_site.EmitPatchInfo(); |
5077 __ bind(&done); | 5062 __ bind(&done); |
5078 | 5063 |
5079 if (is_strong(language_mode())) { | 5064 if (is_strong(language_mode())) { |
5080 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); | 5065 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); |
5081 } | 5066 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5277 Split(eq, if_true, if_false, fall_through); | 5262 Split(eq, if_true, if_false, fall_through); |
5278 } else { | 5263 } else { |
5279 if (if_false != fall_through) __ jmp(if_false); | 5264 if (if_false != fall_through) __ jmp(if_false); |
5280 } | 5265 } |
5281 context()->Plug(if_true, if_false); | 5266 context()->Plug(if_true, if_false); |
5282 } | 5267 } |
5283 | 5268 |
5284 | 5269 |
5285 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { | 5270 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
5286 Comment cmnt(masm_, "[ CompareOperation"); | 5271 Comment cmnt(masm_, "[ CompareOperation"); |
5287 SetSourcePosition(expr->position()); | 5272 SetExpressionPosition(expr); |
5288 | 5273 |
5289 // First we try a fast inlined version of the compare when one of | 5274 // First we try a fast inlined version of the compare when one of |
5290 // the operands is a literal. | 5275 // the operands is a literal. |
5291 if (TryLiteralCompare(expr)) return; | 5276 if (TryLiteralCompare(expr)) return; |
5292 | 5277 |
5293 // Always perform the comparison for its control flow. Pack the result | 5278 // Always perform the comparison for its control flow. Pack the result |
5294 // into the expression's context after the comparison is performed. | 5279 // into the expression's context after the comparison is performed. |
5295 Label materialize_true, materialize_false; | 5280 Label materialize_true, materialize_false; |
5296 Label* if_true = NULL; | 5281 Label* if_true = NULL; |
5297 Label* if_false = NULL; | 5282 Label* if_false = NULL; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5331 JumpPatchSite patch_site(masm_); | 5316 JumpPatchSite patch_site(masm_); |
5332 if (inline_smi_code) { | 5317 if (inline_smi_code) { |
5333 Label slow_case; | 5318 Label slow_case; |
5334 __ orr(r2, r0, Operand(r1)); | 5319 __ orr(r2, r0, Operand(r1)); |
5335 patch_site.EmitJumpIfNotSmi(r2, &slow_case); | 5320 patch_site.EmitJumpIfNotSmi(r2, &slow_case); |
5336 __ cmp(r1, r0); | 5321 __ cmp(r1, r0); |
5337 Split(cond, if_true, if_false, NULL); | 5322 Split(cond, if_true, if_false, NULL); |
5338 __ bind(&slow_case); | 5323 __ bind(&slow_case); |
5339 } | 5324 } |
5340 | 5325 |
5341 // Record position and call the compare IC. | |
5342 SetSourcePosition(expr->position()); | |
5343 Handle<Code> ic = CodeFactory::CompareIC( | 5326 Handle<Code> ic = CodeFactory::CompareIC( |
5344 isolate(), op, strength(language_mode())).code(); | 5327 isolate(), op, strength(language_mode())).code(); |
5345 CallIC(ic, expr->CompareOperationFeedbackId()); | 5328 CallIC(ic, expr->CompareOperationFeedbackId()); |
5346 patch_site.EmitPatchInfo(); | 5329 patch_site.EmitPatchInfo(); |
5347 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5330 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
5348 __ cmp(r0, Operand::Zero()); | 5331 __ cmp(r0, Operand::Zero()); |
5349 Split(cond, if_true, if_false, fall_through); | 5332 Split(cond, if_true, if_false, fall_through); |
5350 } | 5333 } |
5351 } | 5334 } |
5352 | 5335 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5634 DCHECK(interrupt_address == | 5617 DCHECK(interrupt_address == |
5635 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5618 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5636 return OSR_AFTER_STACK_CHECK; | 5619 return OSR_AFTER_STACK_CHECK; |
5637 } | 5620 } |
5638 | 5621 |
5639 | 5622 |
5640 } // namespace internal | 5623 } // namespace internal |
5641 } // namespace v8 | 5624 } // namespace v8 |
5642 | 5625 |
5643 #endif // V8_TARGET_ARCH_ARM | 5626 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |