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

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

Issue 2441543005: [full-codegen] Eliminate unnecessary hole checks for stores (Closed)
Patch Set: Merge and fix modules Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 context()->Plug(v0); 1281 context()->Plug(v0);
1282 break; 1282 break;
1283 } 1283 }
1284 1284
1285 case VariableLocation::PARAMETER: 1285 case VariableLocation::PARAMETER:
1286 case VariableLocation::LOCAL: 1286 case VariableLocation::LOCAL:
1287 case VariableLocation::CONTEXT: { 1287 case VariableLocation::CONTEXT: {
1288 DCHECK_EQ(NOT_INSIDE_TYPEOF, typeof_mode); 1288 DCHECK_EQ(NOT_INSIDE_TYPEOF, typeof_mode);
1289 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" 1289 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
1290 : "[ Stack variable"); 1290 : "[ Stack variable");
1291 if (proxy->needs_hole_check()) { 1291 if (proxy->hole_check_mode() == HoleCheckMode::kRequired) {
1292 // Throw a reference error when using an uninitialized let/const 1292 // Throw a reference error when using an uninitialized let/const
1293 // binding in harmony mode. 1293 // binding in harmony mode.
1294 Label done; 1294 Label done;
1295 GetVar(v0, var); 1295 GetVar(v0, var);
1296 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 1296 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
1297 __ dsubu(at, v0, at); // Sub as compare: at == 0 on eq. 1297 __ dsubu(at, v0, at); // Sub as compare: at == 0 on eq.
1298 __ Branch(&done, ne, at, Operand(zero_reg)); 1298 __ Branch(&done, ne, at, Operand(zero_reg));
1299 __ li(a0, Operand(var->name())); 1299 __ li(a0, Operand(var->name()));
1300 __ push(a0); 1300 __ push(a0);
1301 __ CallRuntime(Runtime::kThrowReferenceError); 1301 __ CallRuntime(Runtime::kThrowReferenceError);
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 // Deoptimization point in case the binary operation may have side effects. 1725 // Deoptimization point in case the binary operation may have side effects.
1726 PrepareForBailout(expr->binary_operation(), BailoutState::TOS_REGISTER); 1726 PrepareForBailout(expr->binary_operation(), BailoutState::TOS_REGISTER);
1727 } else { 1727 } else {
1728 VisitForAccumulatorValue(expr->value()); 1728 VisitForAccumulatorValue(expr->value());
1729 } 1729 }
1730 1730
1731 SetExpressionPosition(expr); 1731 SetExpressionPosition(expr);
1732 1732
1733 // Store the value. 1733 // Store the value.
1734 switch (assign_type) { 1734 switch (assign_type) {
1735 case VARIABLE: 1735 case VARIABLE: {
1736 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), 1736 VariableProxy* proxy = expr->target()->AsVariableProxy();
1737 expr->op(), expr->AssignmentSlot()); 1737 EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(),
1738 proxy->hole_check_mode());
1738 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 1739 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
1739 context()->Plug(v0); 1740 context()->Plug(v0);
1740 break; 1741 break;
1742 }
1741 case NAMED_PROPERTY: 1743 case NAMED_PROPERTY:
1742 EmitNamedPropertyAssignment(expr); 1744 EmitNamedPropertyAssignment(expr);
1743 break; 1745 break;
1744 case NAMED_SUPER_PROPERTY: 1746 case NAMED_SUPER_PROPERTY:
1745 EmitNamedSuperPropertyStore(property); 1747 EmitNamedSuperPropertyStore(property);
1746 context()->Plug(v0); 1748 context()->Plug(v0);
1747 break; 1749 break;
1748 case KEYED_SUPER_PROPERTY: 1750 case KEYED_SUPER_PROPERTY:
1749 EmitKeyedSuperPropertyStore(property); 1751 EmitKeyedSuperPropertyStore(property);
1750 context()->Plug(v0); 1752 context()->Plug(v0);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
2095 __ sd(result_register(), location); 2098 __ sd(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 __ ld(a3, location); 2124 __ ld(a3, location);
2122 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex); 2125 __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
2123 __ Branch(&assign, ne, a3, Operand(a4)); 2126 __ Branch(&assign, ne, a3, Operand(a4));
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
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
3643 reinterpret_cast<uint64_t>( 3648 reinterpret_cast<uint64_t>(
3644 isolate->builtins()->OnStackReplacement()->entry())); 3649 isolate->builtins()->OnStackReplacement()->entry()));
3645 return ON_STACK_REPLACEMENT; 3650 return ON_STACK_REPLACEMENT;
3646 } 3651 }
3647 3652
3648 3653
3649 } // namespace internal 3654 } // namespace internal
3650 } // namespace v8 3655 } // namespace v8
3651 3656
3652 #endif // V8_TARGET_ARCH_MIPS64 3657 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698