| 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 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 6 | 6 |
| 7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
| 8 // | 8 // |
| 9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
| 10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 context()->Plug(v0); | 1280 context()->Plug(v0); |
| 1281 break; | 1281 break; |
| 1282 } | 1282 } |
| 1283 | 1283 |
| 1284 case VariableLocation::PARAMETER: | 1284 case VariableLocation::PARAMETER: |
| 1285 case VariableLocation::LOCAL: | 1285 case VariableLocation::LOCAL: |
| 1286 case VariableLocation::CONTEXT: { | 1286 case VariableLocation::CONTEXT: { |
| 1287 DCHECK_EQ(NOT_INSIDE_TYPEOF, typeof_mode); | 1287 DCHECK_EQ(NOT_INSIDE_TYPEOF, typeof_mode); |
| 1288 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1288 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
| 1289 : "[ Stack variable"); | 1289 : "[ Stack variable"); |
| 1290 if (proxy->needs_hole_check()) { | 1290 if (proxy->hole_check_mode() == HoleCheckMode::kRequired) { |
| 1291 // Throw a reference error when using an uninitialized let/const | 1291 // Throw a reference error when using an uninitialized let/const |
| 1292 // binding in harmony mode. | 1292 // binding in harmony mode. |
| 1293 Label done; | 1293 Label done; |
| 1294 GetVar(v0, var); | 1294 GetVar(v0, var); |
| 1295 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 1295 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 1296 __ subu(at, v0, at); // Sub as compare: at == 0 on eq. | 1296 __ subu(at, v0, at); // Sub as compare: at == 0 on eq. |
| 1297 __ Branch(&done, ne, at, Operand(zero_reg)); | 1297 __ Branch(&done, ne, at, Operand(zero_reg)); |
| 1298 __ li(a0, Operand(var->name())); | 1298 __ li(a0, Operand(var->name())); |
| 1299 __ push(a0); | 1299 __ push(a0); |
| 1300 __ CallRuntime(Runtime::kThrowReferenceError); | 1300 __ CallRuntime(Runtime::kThrowReferenceError); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1724 // Deoptimization point in case the binary operation may have side effects. | 1724 // Deoptimization point in case the binary operation may have side effects. |
| 1725 PrepareForBailout(expr->binary_operation(), BailoutState::TOS_REGISTER); | 1725 PrepareForBailout(expr->binary_operation(), BailoutState::TOS_REGISTER); |
| 1726 } else { | 1726 } else { |
| 1727 VisitForAccumulatorValue(expr->value()); | 1727 VisitForAccumulatorValue(expr->value()); |
| 1728 } | 1728 } |
| 1729 | 1729 |
| 1730 SetExpressionPosition(expr); | 1730 SetExpressionPosition(expr); |
| 1731 | 1731 |
| 1732 // Store the value. | 1732 // Store the value. |
| 1733 switch (assign_type) { | 1733 switch (assign_type) { |
| 1734 case VARIABLE: | 1734 case VARIABLE: { |
| 1735 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), | 1735 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
| 1736 expr->op(), expr->AssignmentSlot()); | 1736 EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(), |
| 1737 proxy->hole_check_mode()); |
| 1737 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 1738 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 1738 context()->Plug(v0); | 1739 context()->Plug(v0); |
| 1739 break; | 1740 break; |
| 1741 } |
| 1740 case NAMED_PROPERTY: | 1742 case NAMED_PROPERTY: |
| 1741 EmitNamedPropertyAssignment(expr); | 1743 EmitNamedPropertyAssignment(expr); |
| 1742 break; | 1744 break; |
| 1743 case NAMED_SUPER_PROPERTY: | 1745 case NAMED_SUPER_PROPERTY: |
| 1744 EmitNamedSuperPropertyStore(property); | 1746 EmitNamedSuperPropertyStore(property); |
| 1745 context()->Plug(v0); | 1747 context()->Plug(v0); |
| 1746 break; | 1748 break; |
| 1747 case KEYED_SUPER_PROPERTY: | 1749 case KEYED_SUPER_PROPERTY: |
| 1748 EmitKeyedSuperPropertyStore(property); | 1750 EmitKeyedSuperPropertyStore(property); |
| 1749 context()->Plug(v0); | 1751 context()->Plug(v0); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 | 2020 |
| 2019 void FullCodeGenerator::EmitAssignment(Expression* expr, | 2021 void FullCodeGenerator::EmitAssignment(Expression* expr, |
| 2020 FeedbackVectorSlot slot) { | 2022 FeedbackVectorSlot slot) { |
| 2021 DCHECK(expr->IsValidReferenceExpressionOrThis()); | 2023 DCHECK(expr->IsValidReferenceExpressionOrThis()); |
| 2022 | 2024 |
| 2023 Property* prop = expr->AsProperty(); | 2025 Property* prop = expr->AsProperty(); |
| 2024 LhsKind assign_type = Property::GetAssignType(prop); | 2026 LhsKind assign_type = Property::GetAssignType(prop); |
| 2025 | 2027 |
| 2026 switch (assign_type) { | 2028 switch (assign_type) { |
| 2027 case VARIABLE: { | 2029 case VARIABLE: { |
| 2028 Variable* var = expr->AsVariableProxy()->var(); | 2030 VariableProxy* proxy = expr->AsVariableProxy(); |
| 2029 EffectContext context(this); | 2031 EffectContext context(this); |
| 2030 EmitVariableAssignment(var, Token::ASSIGN, slot); | 2032 EmitVariableAssignment(proxy->var(), Token::ASSIGN, slot, |
| 2033 proxy->hole_check_mode()); |
| 2031 break; | 2034 break; |
| 2032 } | 2035 } |
| 2033 case NAMED_PROPERTY: { | 2036 case NAMED_PROPERTY: { |
| 2034 PushOperand(result_register()); // Preserve value. | 2037 PushOperand(result_register()); // Preserve value. |
| 2035 VisitForAccumulatorValue(prop->obj()); | 2038 VisitForAccumulatorValue(prop->obj()); |
| 2036 __ mov(StoreDescriptor::ReceiverRegister(), result_register()); | 2039 __ mov(StoreDescriptor::ReceiverRegister(), result_register()); |
| 2037 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. | 2040 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. |
| 2038 CallStoreIC(slot, prop->key()->AsLiteral()->value()); | 2041 CallStoreIC(slot, prop->key()->AsLiteral()->value()); |
| 2039 break; | 2042 break; |
| 2040 } | 2043 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 __ sw(result_register(), location); | 2098 __ sw(result_register(), location); |
| 2096 if (var->IsContextSlot()) { | 2099 if (var->IsContextSlot()) { |
| 2097 // RecordWrite may destroy all its register arguments. | 2100 // RecordWrite may destroy all its register arguments. |
| 2098 __ Move(a3, result_register()); | 2101 __ Move(a3, result_register()); |
| 2099 int offset = Context::SlotOffset(var->index()); | 2102 int offset = Context::SlotOffset(var->index()); |
| 2100 __ RecordWriteContextSlot( | 2103 __ RecordWriteContextSlot( |
| 2101 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs); | 2104 a1, offset, a3, a2, kRAHasBeenSaved, kDontSaveFPRegs); |
| 2102 } | 2105 } |
| 2103 } | 2106 } |
| 2104 | 2107 |
| 2105 | |
| 2106 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2108 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
| 2107 FeedbackVectorSlot slot) { | 2109 FeedbackVectorSlot slot, |
| 2110 HoleCheckMode hole_check_mode) { |
| 2108 if (var->IsUnallocated()) { | 2111 if (var->IsUnallocated()) { |
| 2109 // Global var, const, or let. | 2112 // Global var, const, or let. |
| 2110 __ mov(StoreDescriptor::ValueRegister(), result_register()); | 2113 __ mov(StoreDescriptor::ValueRegister(), result_register()); |
| 2111 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); | 2114 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); |
| 2112 CallStoreIC(slot, var->name()); | 2115 CallStoreIC(slot, var->name()); |
| 2113 | 2116 |
| 2114 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { | 2117 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { |
| 2115 DCHECK(!var->IsLookupSlot()); | 2118 DCHECK(!var->IsLookupSlot()); |
| 2116 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2119 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2117 MemOperand location = VarOperand(var, a1); | 2120 MemOperand location = VarOperand(var, a1); |
| 2118 // Perform an initialization check for lexically declared variables. | 2121 // Perform an initialization check for lexically declared variables. |
| 2119 if (var->binding_needs_init()) { | 2122 if (hole_check_mode == HoleCheckMode::kRequired) { |
| 2120 Label assign; | 2123 Label assign; |
| 2121 __ lw(a3, location); | 2124 __ lw(a3, location); |
| 2122 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); | 2125 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); |
| 2123 __ Branch(&assign, ne, a3, Operand(t0)); | 2126 __ Branch(&assign, ne, a3, Operand(t0)); |
| 2124 __ li(a3, Operand(var->name())); | 2127 __ li(a3, Operand(var->name())); |
| 2125 __ push(a3); | 2128 __ push(a3); |
| 2126 __ CallRuntime(Runtime::kThrowReferenceError); | 2129 __ CallRuntime(Runtime::kThrowReferenceError); |
| 2127 __ bind(&assign); | 2130 __ bind(&assign); |
| 2128 } | 2131 } |
| 2129 if (var->mode() != CONST) { | 2132 if (var->mode() != CONST) { |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3188 | 3191 |
| 3189 SetExpressionPosition(expr); | 3192 SetExpressionPosition(expr); |
| 3190 | 3193 |
| 3191 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD).code(); | 3194 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD).code(); |
| 3192 CallIC(code, expr->CountBinOpFeedbackId()); | 3195 CallIC(code, expr->CountBinOpFeedbackId()); |
| 3193 patch_site.EmitPatchInfo(); | 3196 patch_site.EmitPatchInfo(); |
| 3194 __ bind(&done); | 3197 __ bind(&done); |
| 3195 | 3198 |
| 3196 // Store the value returned in v0. | 3199 // Store the value returned in v0. |
| 3197 switch (assign_type) { | 3200 switch (assign_type) { |
| 3198 case VARIABLE: | 3201 case VARIABLE: { |
| 3202 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
| 3199 if (expr->is_postfix()) { | 3203 if (expr->is_postfix()) { |
| 3200 { EffectContext context(this); | 3204 { EffectContext context(this); |
| 3201 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3205 EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(), |
| 3202 Token::ASSIGN, expr->CountSlot()); | 3206 proxy->hole_check_mode()); |
| 3203 PrepareForBailoutForId(expr->AssignmentId(), | 3207 PrepareForBailoutForId(expr->AssignmentId(), |
| 3204 BailoutState::TOS_REGISTER); | 3208 BailoutState::TOS_REGISTER); |
| 3205 context.Plug(v0); | 3209 context.Plug(v0); |
| 3206 } | 3210 } |
| 3207 // For all contexts except EffectConstant we have the result on | 3211 // For all contexts except EffectConstant we have the result on |
| 3208 // top of the stack. | 3212 // top of the stack. |
| 3209 if (!context()->IsEffect()) { | 3213 if (!context()->IsEffect()) { |
| 3210 context()->PlugTOS(); | 3214 context()->PlugTOS(); |
| 3211 } | 3215 } |
| 3212 } else { | 3216 } else { |
| 3213 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 3217 EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(), |
| 3214 Token::ASSIGN, expr->CountSlot()); | 3218 proxy->hole_check_mode()); |
| 3215 PrepareForBailoutForId(expr->AssignmentId(), | 3219 PrepareForBailoutForId(expr->AssignmentId(), |
| 3216 BailoutState::TOS_REGISTER); | 3220 BailoutState::TOS_REGISTER); |
| 3217 context()->Plug(v0); | 3221 context()->Plug(v0); |
| 3218 } | 3222 } |
| 3219 break; | 3223 break; |
| 3224 } |
| 3220 case NAMED_PROPERTY: { | 3225 case NAMED_PROPERTY: { |
| 3221 __ mov(StoreDescriptor::ValueRegister(), result_register()); | 3226 __ mov(StoreDescriptor::ValueRegister(), result_register()); |
| 3222 PopOperand(StoreDescriptor::ReceiverRegister()); | 3227 PopOperand(StoreDescriptor::ReceiverRegister()); |
| 3223 CallStoreIC(expr->CountSlot(), prop->key()->AsLiteral()->value()); | 3228 CallStoreIC(expr->CountSlot(), prop->key()->AsLiteral()->value()); |
| 3224 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); | 3229 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); |
| 3225 if (expr->is_postfix()) { | 3230 if (expr->is_postfix()) { |
| 3226 if (!context()->IsEffect()) { | 3231 if (!context()->IsEffect()) { |
| 3227 context()->PlugTOS(); | 3232 context()->PlugTOS(); |
| 3228 } | 3233 } |
| 3229 } else { | 3234 } else { |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3636 reinterpret_cast<uint32_t>( | 3641 reinterpret_cast<uint32_t>( |
| 3637 isolate->builtins()->OnStackReplacement()->entry())); | 3642 isolate->builtins()->OnStackReplacement()->entry())); |
| 3638 return ON_STACK_REPLACEMENT; | 3643 return ON_STACK_REPLACEMENT; |
| 3639 } | 3644 } |
| 3640 | 3645 |
| 3641 | 3646 |
| 3642 } // namespace internal | 3647 } // namespace internal |
| 3643 } // namespace v8 | 3648 } // namespace v8 |
| 3644 | 3649 |
| 3645 #endif // V8_TARGET_ARCH_MIPS | 3650 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |