| 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); |
| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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. |
| 2831 Property* prop = expr->target()->AsProperty(); | 2832 Property* prop = expr->target()->AsProperty(); |
| 2832 DCHECK(prop != NULL); | 2833 DCHECK(prop != NULL); |
| 2833 DCHECK(prop->key()->IsLiteral()); | 2834 DCHECK(prop->key()->IsLiteral()); |
| 2834 | 2835 |
| 2835 // Record source code position before IC call. | |
| 2836 SetSourcePosition(expr->position()); | |
| 2837 __ mov(StoreDescriptor::NameRegister(), | 2836 __ mov(StoreDescriptor::NameRegister(), |
| 2838 Operand(prop->key()->AsLiteral()->value())); | 2837 Operand(prop->key()->AsLiteral()->value())); |
| 2839 __ pop(StoreDescriptor::ReceiverRegister()); | 2838 __ pop(StoreDescriptor::ReceiverRegister()); |
| 2840 if (FLAG_vector_stores) { | 2839 if (FLAG_vector_stores) { |
| 2841 EmitLoadStoreICSlot(expr->AssignmentSlot()); | 2840 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2842 CallStoreIC(); | 2841 CallStoreIC(); |
| 2843 } else { | 2842 } else { |
| 2844 CallStoreIC(expr->AssignmentFeedbackId()); | 2843 CallStoreIC(expr->AssignmentFeedbackId()); |
| 2845 } | 2844 } |
| 2846 | 2845 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2874 __ Push(r0); | 2873 __ Push(r0); |
| 2875 __ CallRuntime( | 2874 __ CallRuntime( |
| 2876 (is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 2875 (is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
| 2877 : Runtime::kStoreKeyedToSuper_Sloppy), | 2876 : Runtime::kStoreKeyedToSuper_Sloppy), |
| 2878 4); | 2877 4); |
| 2879 } | 2878 } |
| 2880 | 2879 |
| 2881 | 2880 |
| 2882 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2881 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| 2883 // Assignment to a property, using a keyed store IC. | 2882 // Assignment to a property, using a keyed store IC. |
| 2884 | |
| 2885 // Record source code position before IC call. | |
| 2886 SetSourcePosition(expr->position()); | |
| 2887 __ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister()); | 2883 __ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister()); |
| 2888 DCHECK(StoreDescriptor::ValueRegister().is(r0)); | 2884 DCHECK(StoreDescriptor::ValueRegister().is(r0)); |
| 2889 | 2885 |
| 2890 Handle<Code> ic = | 2886 Handle<Code> ic = |
| 2891 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); | 2887 CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); |
| 2892 if (FLAG_vector_stores) { | 2888 if (FLAG_vector_stores) { |
| 2893 EmitLoadStoreICSlot(expr->AssignmentSlot()); | 2889 EmitLoadStoreICSlot(expr->AssignmentSlot()); |
| 2894 CallIC(ic); | 2890 CallIC(ic); |
| 2895 } else { | 2891 } else { |
| 2896 CallIC(ic, expr->AssignmentFeedbackId()); | 2892 CallIC(ic, expr->AssignmentFeedbackId()); |
| 2897 } | 2893 } |
| 2898 | 2894 |
| 2899 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2895 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 2900 context()->Plug(r0); | 2896 context()->Plug(r0); |
| 2901 } | 2897 } |
| 2902 | 2898 |
| 2903 | 2899 |
| 2904 void FullCodeGenerator::VisitProperty(Property* expr) { | 2900 void FullCodeGenerator::VisitProperty(Property* expr) { |
| 2905 Comment cmnt(masm_, "[ Property"); | 2901 Comment cmnt(masm_, "[ Property"); |
| 2902 SetExpressionPosition(expr); |
| 2903 |
| 2906 Expression* key = expr->key(); | 2904 Expression* key = expr->key(); |
| 2907 | 2905 |
| 2908 if (key->IsPropertyName()) { | 2906 if (key->IsPropertyName()) { |
| 2909 if (!expr->IsSuperAccess()) { | 2907 if (!expr->IsSuperAccess()) { |
| 2910 VisitForAccumulatorValue(expr->obj()); | 2908 VisitForAccumulatorValue(expr->obj()); |
| 2911 __ Move(LoadDescriptor::ReceiverRegister(), r0); | 2909 __ Move(LoadDescriptor::ReceiverRegister(), r0); |
| 2912 EmitNamedPropertyLoad(expr); | 2910 EmitNamedPropertyLoad(expr); |
| 2913 } else { | 2911 } else { |
| 2914 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2912 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
| 2915 VisitForStackValue( | 2913 VisitForStackValue( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2978 | 2976 |
| 2979 EmitCall(expr, call_type); | 2977 EmitCall(expr, call_type); |
| 2980 } | 2978 } |
| 2981 | 2979 |
| 2982 | 2980 |
| 2983 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { | 2981 void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { |
| 2984 Expression* callee = expr->expression(); | 2982 Expression* callee = expr->expression(); |
| 2985 DCHECK(callee->IsProperty()); | 2983 DCHECK(callee->IsProperty()); |
| 2986 Property* prop = callee->AsProperty(); | 2984 Property* prop = callee->AsProperty(); |
| 2987 DCHECK(prop->IsSuperAccess()); | 2985 DCHECK(prop->IsSuperAccess()); |
| 2986 SetExpressionPosition(prop); |
| 2988 | 2987 |
| 2989 SetSourcePosition(prop->position()); | |
| 2990 Literal* key = prop->key()->AsLiteral(); | 2988 Literal* key = prop->key()->AsLiteral(); |
| 2991 DCHECK(!key->value()->IsSmi()); | 2989 DCHECK(!key->value()->IsSmi()); |
| 2992 // Load the function from the receiver. | 2990 // Load the function from the receiver. |
| 2993 const Register scratch = r1; | 2991 const Register scratch = r1; |
| 2994 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2992 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
| 2995 VisitForStackValue(super_ref->home_object()); | 2993 VisitForStackValue(super_ref->home_object()); |
| 2996 VisitForAccumulatorValue(super_ref->this_var()); | 2994 VisitForAccumulatorValue(super_ref->this_var()); |
| 2997 __ Push(r0); | 2995 __ Push(r0); |
| 2998 __ Push(r0); | 2996 __ Push(r0); |
| 2999 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); | 2997 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3043 EmitCall(expr, CallICState::METHOD); | 3041 EmitCall(expr, CallICState::METHOD); |
| 3044 } | 3042 } |
| 3045 | 3043 |
| 3046 | 3044 |
| 3047 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 3045 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
| 3048 Expression* callee = expr->expression(); | 3046 Expression* callee = expr->expression(); |
| 3049 DCHECK(callee->IsProperty()); | 3047 DCHECK(callee->IsProperty()); |
| 3050 Property* prop = callee->AsProperty(); | 3048 Property* prop = callee->AsProperty(); |
| 3051 DCHECK(prop->IsSuperAccess()); | 3049 DCHECK(prop->IsSuperAccess()); |
| 3052 | 3050 |
| 3053 SetSourcePosition(prop->position()); | 3051 SetExpressionPosition(prop); |
| 3054 // Load the function from the receiver. | 3052 // Load the function from the receiver. |
| 3055 const Register scratch = r1; | 3053 const Register scratch = r1; |
| 3056 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 3054 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
| 3057 VisitForStackValue(super_ref->home_object()); | 3055 VisitForStackValue(super_ref->home_object()); |
| 3058 VisitForAccumulatorValue(super_ref->this_var()); | 3056 VisitForAccumulatorValue(super_ref->this_var()); |
| 3059 __ Push(r0); | 3057 __ Push(r0); |
| 3060 __ Push(r0); | 3058 __ Push(r0); |
| 3061 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); | 3059 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); |
| 3062 __ Push(scratch); | 3060 __ Push(scratch); |
| 3063 VisitForStackValue(prop->key()); | 3061 VisitForStackValue(prop->key()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3079 // - target function | 3077 // - target function |
| 3080 // - this (receiver) | 3078 // - this (receiver) |
| 3081 EmitCall(expr, CallICState::METHOD); | 3079 EmitCall(expr, CallICState::METHOD); |
| 3082 } | 3080 } |
| 3083 | 3081 |
| 3084 | 3082 |
| 3085 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 3083 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
| 3086 // Load the arguments. | 3084 // Load the arguments. |
| 3087 ZoneList<Expression*>* args = expr->arguments(); | 3085 ZoneList<Expression*>* args = expr->arguments(); |
| 3088 int arg_count = args->length(); | 3086 int arg_count = args->length(); |
| 3089 { PreservePositionScope scope(masm()->positions_recorder()); | 3087 for (int i = 0; i < arg_count; i++) { |
| 3090 for (int i = 0; i < arg_count; i++) { | 3088 VisitForStackValue(args->at(i)); |
| 3091 VisitForStackValue(args->at(i)); | |
| 3092 } | |
| 3093 } | 3089 } |
| 3094 | 3090 |
| 3095 // Record source position of the IC call. | 3091 SetExpressionPosition(expr); |
| 3096 SetSourcePosition(expr->position()); | |
| 3097 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 3092 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
| 3098 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); | 3093 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
| 3099 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3094 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 3100 // Don't assign a type feedback id to the IC, since type feedback is provided | 3095 // Don't assign a type feedback id to the IC, since type feedback is provided |
| 3101 // by the vector above. | 3096 // by the vector above. |
| 3102 CallIC(ic); | 3097 CallIC(ic); |
| 3103 | 3098 |
| 3104 RecordJSReturnSite(expr); | 3099 RecordJSReturnSite(expr); |
| 3105 // Restore context register. | 3100 // Restore context register. |
| 3106 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3101 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3145 | 3140 |
| 3146 EmitVariableAssignment(this_var, Token::INIT_CONST, slot); | 3141 EmitVariableAssignment(this_var, Token::INIT_CONST, slot); |
| 3147 } | 3142 } |
| 3148 | 3143 |
| 3149 | 3144 |
| 3150 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. | 3145 // See http://www.ecma-international.org/ecma-262/6.0/#sec-function-calls. |
| 3151 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { | 3146 void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
| 3152 VariableProxy* callee = expr->expression()->AsVariableProxy(); | 3147 VariableProxy* callee = expr->expression()->AsVariableProxy(); |
| 3153 if (callee->var()->IsLookupSlot()) { | 3148 if (callee->var()->IsLookupSlot()) { |
| 3154 Label slow, done; | 3149 Label slow, done; |
| 3155 SetSourcePosition(callee->position()); | 3150 SetExpressionPosition(callee); |
| 3156 { | 3151 // Generate code for loading from variables potentially shadowed |
| 3157 PreservePositionScope scope(masm()->positions_recorder()); | 3152 // by eval-introduced variables. |
| 3158 // Generate code for loading from variables potentially shadowed | 3153 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); |
| 3159 // by eval-introduced variables. | |
| 3160 EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); | |
| 3161 } | |
| 3162 | 3154 |
| 3163 __ bind(&slow); | 3155 __ bind(&slow); |
| 3164 // Call the runtime to find the function to call (returned in r0) | 3156 // Call the runtime to find the function to call (returned in r0) |
| 3165 // and the object holding it (returned in edx). | 3157 // and the object holding it (returned in edx). |
| 3166 DCHECK(!context_register().is(r2)); | 3158 DCHECK(!context_register().is(r2)); |
| 3167 __ mov(r2, Operand(callee->name())); | 3159 __ mov(r2, Operand(callee->name())); |
| 3168 __ Push(context_register(), r2); | 3160 __ Push(context_register(), r2); |
| 3169 __ CallRuntime(Runtime::kLoadLookupSlot, 2); | 3161 __ CallRuntime(Runtime::kLoadLookupSlot, 2); |
| 3170 __ Push(r0, r1); // Function, receiver. | 3162 __ Push(r0, r1); // Function, receiver. |
| 3171 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); | 3163 PrepareForBailoutForId(expr->LookupId(), NO_REGISTERS); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3205 Expression* callee = expr->expression(); | 3197 Expression* callee = expr->expression(); |
| 3206 Call::CallType call_type = expr->GetCallType(isolate()); | 3198 Call::CallType call_type = expr->GetCallType(isolate()); |
| 3207 | 3199 |
| 3208 if (call_type == Call::POSSIBLY_EVAL_CALL) { | 3200 if (call_type == Call::POSSIBLY_EVAL_CALL) { |
| 3209 // In a call to eval, we first call | 3201 // In a call to eval, we first call |
| 3210 // RuntimeHidden_asResolvePossiblyDirectEval to resolve the function we need | 3202 // RuntimeHidden_asResolvePossiblyDirectEval to resolve the function we need |
| 3211 // to call. Then we call the resolved function using the given arguments. | 3203 // to call. Then we call the resolved function using the given arguments. |
| 3212 ZoneList<Expression*>* args = expr->arguments(); | 3204 ZoneList<Expression*>* args = expr->arguments(); |
| 3213 int arg_count = args->length(); | 3205 int arg_count = args->length(); |
| 3214 | 3206 |
| 3215 { PreservePositionScope pos_scope(masm()->positions_recorder()); | 3207 PushCalleeAndWithBaseObject(expr); |
| 3216 PushCalleeAndWithBaseObject(expr); | |
| 3217 | 3208 |
| 3218 // Push the arguments. | 3209 // Push the arguments. |
| 3219 for (int i = 0; i < arg_count; i++) { | 3210 for (int i = 0; i < arg_count; i++) { |
| 3220 VisitForStackValue(args->at(i)); | 3211 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 } | 3212 } |
| 3234 | 3213 |
| 3214 // Push a copy of the function (found below the arguments) and |
| 3215 // resolve eval. |
| 3216 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 3217 __ push(r1); |
| 3218 EmitResolvePossiblyDirectEval(arg_count); |
| 3219 |
| 3220 // Touch up the stack with the resolved function. |
| 3221 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 3222 |
| 3223 PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
| 3224 |
| 3235 // Record source position for debugger. | 3225 // Record source position for debugger. |
| 3236 SetSourcePosition(expr->position()); | 3226 SetExpressionPosition(expr); |
| 3237 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 3227 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| 3238 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 3228 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 3239 __ CallStub(&stub); | 3229 __ CallStub(&stub); |
| 3240 RecordJSReturnSite(expr); | 3230 RecordJSReturnSite(expr); |
| 3241 // Restore context register. | 3231 // Restore context register. |
| 3242 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3232 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 3243 context()->DropAndPlug(1, r0); | 3233 context()->DropAndPlug(1, r0); |
| 3244 } else if (call_type == Call::GLOBAL_CALL) { | 3234 } else if (call_type == Call::GLOBAL_CALL) { |
| 3245 EmitCallWithLoadIC(expr); | 3235 EmitCallWithLoadIC(expr); |
| 3246 | 3236 |
| 3247 } else if (call_type == Call::LOOKUP_SLOT_CALL) { | 3237 } else if (call_type == Call::LOOKUP_SLOT_CALL) { |
| 3248 // Call to a lookup slot (dynamically introduced variable). | 3238 // Call to a lookup slot (dynamically introduced variable). |
| 3249 PushCalleeAndWithBaseObject(expr); | 3239 PushCalleeAndWithBaseObject(expr); |
| 3250 EmitCall(expr); | 3240 EmitCall(expr); |
| 3251 } else if (call_type == Call::PROPERTY_CALL) { | 3241 } else if (call_type == Call::PROPERTY_CALL) { |
| 3252 Property* property = callee->AsProperty(); | 3242 Property* property = callee->AsProperty(); |
| 3253 bool is_named_call = property->key()->IsPropertyName(); | 3243 bool is_named_call = property->key()->IsPropertyName(); |
| 3254 if (property->IsSuperAccess()) { | 3244 if (property->IsSuperAccess()) { |
| 3255 if (is_named_call) { | 3245 if (is_named_call) { |
| 3256 EmitSuperCallWithLoadIC(expr); | 3246 EmitSuperCallWithLoadIC(expr); |
| 3257 } else { | 3247 } else { |
| 3258 EmitKeyedSuperCallWithLoadIC(expr); | 3248 EmitKeyedSuperCallWithLoadIC(expr); |
| 3259 } | 3249 } |
| 3260 } else { | 3250 } else { |
| 3261 { | |
| 3262 PreservePositionScope scope(masm()->positions_recorder()); | |
| 3263 VisitForStackValue(property->obj()); | 3251 VisitForStackValue(property->obj()); |
| 3264 } | |
| 3265 if (is_named_call) { | 3252 if (is_named_call) { |
| 3266 EmitCallWithLoadIC(expr); | 3253 EmitCallWithLoadIC(expr); |
| 3267 } else { | 3254 } else { |
| 3268 EmitKeyedCallWithLoadIC(expr, property->key()); | 3255 EmitKeyedCallWithLoadIC(expr, property->key()); |
| 3269 } | 3256 } |
| 3270 } | 3257 } |
| 3271 } else if (call_type == Call::SUPER_CALL) { | 3258 } else if (call_type == Call::SUPER_CALL) { |
| 3272 EmitSuperConstructorCall(expr); | 3259 EmitSuperConstructorCall(expr); |
| 3273 } else { | 3260 } else { |
| 3274 DCHECK(call_type == Call::OTHER_CALL); | 3261 DCHECK(call_type == Call::OTHER_CALL); |
| 3275 // Call to an arbitrary expression not handled specially above. | 3262 // Call to an arbitrary expression not handled specially above. |
| 3276 { PreservePositionScope scope(masm()->positions_recorder()); | 3263 VisitForStackValue(callee); |
| 3277 VisitForStackValue(callee); | |
| 3278 } | |
| 3279 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 3264 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
| 3280 __ push(r1); | 3265 __ push(r1); |
| 3281 // Emit function call. | 3266 // Emit function call. |
| 3282 EmitCall(expr); | 3267 EmitCall(expr); |
| 3283 } | 3268 } |
| 3284 | 3269 |
| 3285 #ifdef DEBUG | 3270 #ifdef DEBUG |
| 3286 // RecordJSReturnSite should have been called. | 3271 // RecordJSReturnSite should have been called. |
| 3287 DCHECK(expr->return_is_recorded_); | 3272 DCHECK(expr->return_is_recorded_); |
| 3288 #endif | 3273 #endif |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3303 | 3288 |
| 3304 // Push the arguments ("left-to-right") on the stack. | 3289 // Push the arguments ("left-to-right") on the stack. |
| 3305 ZoneList<Expression*>* args = expr->arguments(); | 3290 ZoneList<Expression*>* args = expr->arguments(); |
| 3306 int arg_count = args->length(); | 3291 int arg_count = args->length(); |
| 3307 for (int i = 0; i < arg_count; i++) { | 3292 for (int i = 0; i < arg_count; i++) { |
| 3308 VisitForStackValue(args->at(i)); | 3293 VisitForStackValue(args->at(i)); |
| 3309 } | 3294 } |
| 3310 | 3295 |
| 3311 // Call the construct call builtin that handles allocation and | 3296 // Call the construct call builtin that handles allocation and |
| 3312 // constructor invocation. | 3297 // constructor invocation. |
| 3313 SetSourcePosition(expr->position()); | 3298 SetExpressionPosition(expr); |
| 3314 | 3299 |
| 3315 // Load function and argument count into r1 and r0. | 3300 // Load function and argument count into r1 and r0. |
| 3316 __ mov(r0, Operand(arg_count)); | 3301 __ mov(r0, Operand(arg_count)); |
| 3317 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 3302 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
| 3318 | 3303 |
| 3319 // Record call targets in unoptimized code. | 3304 // Record call targets in unoptimized code. |
| 3320 if (FLAG_pretenuring_call_new) { | 3305 if (FLAG_pretenuring_call_new) { |
| 3321 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3306 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
| 3322 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == | 3307 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
| 3323 expr->CallNewFeedbackSlot().ToInt() + 1); | 3308 expr->CallNewFeedbackSlot().ToInt() + 1); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3346 | 3331 |
| 3347 // Push the arguments ("left-to-right") on the stack. | 3332 // Push the arguments ("left-to-right") on the stack. |
| 3348 ZoneList<Expression*>* args = expr->arguments(); | 3333 ZoneList<Expression*>* args = expr->arguments(); |
| 3349 int arg_count = args->length(); | 3334 int arg_count = args->length(); |
| 3350 for (int i = 0; i < arg_count; i++) { | 3335 for (int i = 0; i < arg_count; i++) { |
| 3351 VisitForStackValue(args->at(i)); | 3336 VisitForStackValue(args->at(i)); |
| 3352 } | 3337 } |
| 3353 | 3338 |
| 3354 // Call the construct call builtin that handles allocation and | 3339 // Call the construct call builtin that handles allocation and |
| 3355 // constructor invocation. | 3340 // constructor invocation. |
| 3356 SetSourcePosition(expr->position()); | 3341 SetExpressionPosition(expr); |
| 3357 | 3342 |
| 3358 // Load function and argument count into r1 and r0. | 3343 // Load function and argument count into r1 and r0. |
| 3359 __ mov(r0, Operand(arg_count)); | 3344 __ mov(r0, Operand(arg_count)); |
| 3360 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); | 3345 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); |
| 3361 | 3346 |
| 3362 // Record call targets in unoptimized code. | 3347 // Record call targets in unoptimized code. |
| 3363 if (FLAG_pretenuring_call_new) { | 3348 if (FLAG_pretenuring_call_new) { |
| 3364 UNREACHABLE(); | 3349 UNREACHABLE(); |
| 3365 /* TODO(dslomov): support pretenuring. | 3350 /* TODO(dslomov): support pretenuring. |
| 3366 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); | 3351 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4725 __ mov(LoadDescriptor::SlotRegister(), | 4710 __ mov(LoadDescriptor::SlotRegister(), |
| 4726 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4711 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
| 4727 CallLoadIC(NOT_CONTEXTUAL); | 4712 CallLoadIC(NOT_CONTEXTUAL); |
| 4728 } | 4713 } |
| 4729 | 4714 |
| 4730 | 4715 |
| 4731 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4716 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 4732 ZoneList<Expression*>* args = expr->arguments(); | 4717 ZoneList<Expression*>* args = expr->arguments(); |
| 4733 int arg_count = args->length(); | 4718 int arg_count = args->length(); |
| 4734 | 4719 |
| 4735 // Record source position of the IC call. | 4720 SetExpressionPosition(expr); |
| 4736 SetSourcePosition(expr->position()); | |
| 4737 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4721 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| 4738 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4722 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 4739 __ CallStub(&stub); | 4723 __ CallStub(&stub); |
| 4740 } | 4724 } |
| 4741 | 4725 |
| 4742 | 4726 |
| 4743 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4727 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
| 4744 ZoneList<Expression*>* args = expr->arguments(); | 4728 ZoneList<Expression*>* args = expr->arguments(); |
| 4745 int arg_count = args->length(); | 4729 int arg_count = args->length(); |
| 4746 | 4730 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4904 default: | 4888 default: |
| 4905 UNREACHABLE(); | 4889 UNREACHABLE(); |
| 4906 } | 4890 } |
| 4907 } | 4891 } |
| 4908 | 4892 |
| 4909 | 4893 |
| 4910 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 4894 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
| 4911 DCHECK(expr->expression()->IsValidReferenceExpression()); | 4895 DCHECK(expr->expression()->IsValidReferenceExpression()); |
| 4912 | 4896 |
| 4913 Comment cmnt(masm_, "[ CountOperation"); | 4897 Comment cmnt(masm_, "[ CountOperation"); |
| 4914 SetSourcePosition(expr->position()); | |
| 4915 | 4898 |
| 4916 Property* prop = expr->expression()->AsProperty(); | 4899 Property* prop = expr->expression()->AsProperty(); |
| 4917 LhsKind assign_type = Property::GetAssignType(prop); | 4900 LhsKind assign_type = Property::GetAssignType(prop); |
| 4918 | 4901 |
| 4919 // Evaluate expression and get value. | 4902 // Evaluate expression and get value. |
| 4920 if (assign_type == VARIABLE) { | 4903 if (assign_type == VARIABLE) { |
| 4921 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); | 4904 DCHECK(expr->expression()->AsVariableProxy()->var() != NULL); |
| 4922 AccumulatorValueContext context(this); | 4905 AccumulatorValueContext context(this); |
| 4923 EmitVariableLoad(expr->expression()->AsVariableProxy()); | 4906 EmitVariableLoad(expr->expression()->AsVariableProxy()); |
| 4924 } else { | 4907 } else { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5060 break; | 5043 break; |
| 5061 } | 5044 } |
| 5062 } | 5045 } |
| 5063 } | 5046 } |
| 5064 | 5047 |
| 5065 | 5048 |
| 5066 __ bind(&stub_call); | 5049 __ bind(&stub_call); |
| 5067 __ mov(r1, r0); | 5050 __ mov(r1, r0); |
| 5068 __ mov(r0, Operand(Smi::FromInt(count_value))); | 5051 __ mov(r0, Operand(Smi::FromInt(count_value))); |
| 5069 | 5052 |
| 5070 // Record position before stub call. | 5053 SetExpressionPosition(expr); |
| 5071 SetSourcePosition(expr->position()); | |
| 5072 | 5054 |
| 5073 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD, | 5055 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD, |
| 5074 strength(language_mode())).code(); | 5056 strength(language_mode())).code(); |
| 5075 CallIC(code, expr->CountBinOpFeedbackId()); | 5057 CallIC(code, expr->CountBinOpFeedbackId()); |
| 5076 patch_site.EmitPatchInfo(); | 5058 patch_site.EmitPatchInfo(); |
| 5077 __ bind(&done); | 5059 __ bind(&done); |
| 5078 | 5060 |
| 5079 if (is_strong(language_mode())) { | 5061 if (is_strong(language_mode())) { |
| 5080 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); | 5062 PrepareForBailoutForId(expr->ToNumberId(), TOS_REG); |
| 5081 } | 5063 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5277 Split(eq, if_true, if_false, fall_through); | 5259 Split(eq, if_true, if_false, fall_through); |
| 5278 } else { | 5260 } else { |
| 5279 if (if_false != fall_through) __ jmp(if_false); | 5261 if (if_false != fall_through) __ jmp(if_false); |
| 5280 } | 5262 } |
| 5281 context()->Plug(if_true, if_false); | 5263 context()->Plug(if_true, if_false); |
| 5282 } | 5264 } |
| 5283 | 5265 |
| 5284 | 5266 |
| 5285 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { | 5267 void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
| 5286 Comment cmnt(masm_, "[ CompareOperation"); | 5268 Comment cmnt(masm_, "[ CompareOperation"); |
| 5287 SetSourcePosition(expr->position()); | 5269 SetExpressionPosition(expr); |
| 5288 | 5270 |
| 5289 // First we try a fast inlined version of the compare when one of | 5271 // First we try a fast inlined version of the compare when one of |
| 5290 // the operands is a literal. | 5272 // the operands is a literal. |
| 5291 if (TryLiteralCompare(expr)) return; | 5273 if (TryLiteralCompare(expr)) return; |
| 5292 | 5274 |
| 5293 // Always perform the comparison for its control flow. Pack the result | 5275 // Always perform the comparison for its control flow. Pack the result |
| 5294 // into the expression's context after the comparison is performed. | 5276 // into the expression's context after the comparison is performed. |
| 5295 Label materialize_true, materialize_false; | 5277 Label materialize_true, materialize_false; |
| 5296 Label* if_true = NULL; | 5278 Label* if_true = NULL; |
| 5297 Label* if_false = NULL; | 5279 Label* if_false = NULL; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5331 JumpPatchSite patch_site(masm_); | 5313 JumpPatchSite patch_site(masm_); |
| 5332 if (inline_smi_code) { | 5314 if (inline_smi_code) { |
| 5333 Label slow_case; | 5315 Label slow_case; |
| 5334 __ orr(r2, r0, Operand(r1)); | 5316 __ orr(r2, r0, Operand(r1)); |
| 5335 patch_site.EmitJumpIfNotSmi(r2, &slow_case); | 5317 patch_site.EmitJumpIfNotSmi(r2, &slow_case); |
| 5336 __ cmp(r1, r0); | 5318 __ cmp(r1, r0); |
| 5337 Split(cond, if_true, if_false, NULL); | 5319 Split(cond, if_true, if_false, NULL); |
| 5338 __ bind(&slow_case); | 5320 __ bind(&slow_case); |
| 5339 } | 5321 } |
| 5340 | 5322 |
| 5341 // Record position and call the compare IC. | |
| 5342 SetSourcePosition(expr->position()); | |
| 5343 Handle<Code> ic = CodeFactory::CompareIC( | 5323 Handle<Code> ic = CodeFactory::CompareIC( |
| 5344 isolate(), op, strength(language_mode())).code(); | 5324 isolate(), op, strength(language_mode())).code(); |
| 5345 CallIC(ic, expr->CompareOperationFeedbackId()); | 5325 CallIC(ic, expr->CompareOperationFeedbackId()); |
| 5346 patch_site.EmitPatchInfo(); | 5326 patch_site.EmitPatchInfo(); |
| 5347 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 5327 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 5348 __ cmp(r0, Operand::Zero()); | 5328 __ cmp(r0, Operand::Zero()); |
| 5349 Split(cond, if_true, if_false, fall_through); | 5329 Split(cond, if_true, if_false, fall_through); |
| 5350 } | 5330 } |
| 5351 } | 5331 } |
| 5352 | 5332 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5634 DCHECK(interrupt_address == | 5614 DCHECK(interrupt_address == |
| 5635 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5615 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5636 return OSR_AFTER_STACK_CHECK; | 5616 return OSR_AFTER_STACK_CHECK; |
| 5637 } | 5617 } |
| 5638 | 5618 |
| 5639 | 5619 |
| 5640 } // namespace internal | 5620 } // namespace internal |
| 5641 } // namespace v8 | 5621 } // namespace v8 |
| 5642 | 5622 |
| 5643 #endif // V8_TARGET_ARCH_ARM | 5623 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |