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

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

Issue 2449473002: PPC/s390: [full-codegen] Eliminate unnecessary hole checks for stores (Closed)
Patch Set: 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 | « no previous file | src/full-codegen/s390/full-codegen-s390.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/full-codegen/full-codegen.h" 7 #include "src/full-codegen/full-codegen.h"
8 #include "src/ast/compile-time-value.h" 8 #include "src/ast/compile-time-value.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 context()->Plug(r3); 1250 context()->Plug(r3);
1251 break; 1251 break;
1252 } 1252 }
1253 1253
1254 case VariableLocation::PARAMETER: 1254 case VariableLocation::PARAMETER:
1255 case VariableLocation::LOCAL: 1255 case VariableLocation::LOCAL:
1256 case VariableLocation::CONTEXT: { 1256 case VariableLocation::CONTEXT: {
1257 DCHECK_EQ(NOT_INSIDE_TYPEOF, typeof_mode); 1257 DCHECK_EQ(NOT_INSIDE_TYPEOF, typeof_mode);
1258 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" 1258 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
1259 : "[ Stack variable"); 1259 : "[ Stack variable");
1260 if (proxy->needs_hole_check()) { 1260 if (proxy->hole_check_mode() == HoleCheckMode::kRequired) {
1261 // Throw a reference error when using an uninitialized let/const 1261 // Throw a reference error when using an uninitialized let/const
1262 // binding in harmony mode. 1262 // binding in harmony mode.
1263 Label done; 1263 Label done;
1264 GetVar(r3, var); 1264 GetVar(r3, var);
1265 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); 1265 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex);
1266 __ bne(&done); 1266 __ bne(&done);
1267 __ mov(r3, Operand(var->name())); 1267 __ mov(r3, Operand(var->name()));
1268 __ push(r3); 1268 __ push(r3);
1269 __ CallRuntime(Runtime::kThrowReferenceError); 1269 __ CallRuntime(Runtime::kThrowReferenceError);
1270 __ bind(&done); 1270 __ bind(&done);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 // Deoptimization point in case the binary operation may have side effects. 1689 // Deoptimization point in case the binary operation may have side effects.
1690 PrepareForBailout(expr->binary_operation(), BailoutState::TOS_REGISTER); 1690 PrepareForBailout(expr->binary_operation(), BailoutState::TOS_REGISTER);
1691 } else { 1691 } else {
1692 VisitForAccumulatorValue(expr->value()); 1692 VisitForAccumulatorValue(expr->value());
1693 } 1693 }
1694 1694
1695 SetExpressionPosition(expr); 1695 SetExpressionPosition(expr);
1696 1696
1697 // Store the value. 1697 // Store the value.
1698 switch (assign_type) { 1698 switch (assign_type) {
1699 case VARIABLE: 1699 case VARIABLE: {
1700 EmitVariableAssignment(expr->target()->AsVariableProxy()->var(), 1700 VariableProxy* proxy = expr->target()->AsVariableProxy();
1701 expr->op(), expr->AssignmentSlot()); 1701 EmitVariableAssignment(proxy->var(), expr->op(), expr->AssignmentSlot(),
1702 proxy->hole_check_mode());
1702 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 1703 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
1703 context()->Plug(r3); 1704 context()->Plug(r3);
1704 break; 1705 break;
1706 }
1705 case NAMED_PROPERTY: 1707 case NAMED_PROPERTY:
1706 EmitNamedPropertyAssignment(expr); 1708 EmitNamedPropertyAssignment(expr);
1707 break; 1709 break;
1708 case NAMED_SUPER_PROPERTY: 1710 case NAMED_SUPER_PROPERTY:
1709 EmitNamedSuperPropertyStore(property); 1711 EmitNamedSuperPropertyStore(property);
1710 context()->Plug(r3); 1712 context()->Plug(r3);
1711 break; 1713 break;
1712 case KEYED_SUPER_PROPERTY: 1714 case KEYED_SUPER_PROPERTY:
1713 EmitKeyedSuperPropertyStore(property); 1715 EmitKeyedSuperPropertyStore(property);
1714 context()->Plug(r3); 1716 context()->Plug(r3);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 2024
2023 void FullCodeGenerator::EmitAssignment(Expression* expr, 2025 void FullCodeGenerator::EmitAssignment(Expression* expr,
2024 FeedbackVectorSlot slot) { 2026 FeedbackVectorSlot slot) {
2025 DCHECK(expr->IsValidReferenceExpressionOrThis()); 2027 DCHECK(expr->IsValidReferenceExpressionOrThis());
2026 2028
2027 Property* prop = expr->AsProperty(); 2029 Property* prop = expr->AsProperty();
2028 LhsKind assign_type = Property::GetAssignType(prop); 2030 LhsKind assign_type = Property::GetAssignType(prop);
2029 2031
2030 switch (assign_type) { 2032 switch (assign_type) {
2031 case VARIABLE: { 2033 case VARIABLE: {
2032 Variable* var = expr->AsVariableProxy()->var(); 2034 VariableProxy* proxy = expr->AsVariableProxy();
2033 EffectContext context(this); 2035 EffectContext context(this);
2034 EmitVariableAssignment(var, Token::ASSIGN, slot); 2036 EmitVariableAssignment(proxy->var(), Token::ASSIGN, slot,
2037 proxy->hole_check_mode());
2035 break; 2038 break;
2036 } 2039 }
2037 case NAMED_PROPERTY: { 2040 case NAMED_PROPERTY: {
2038 PushOperand(r3); // Preserve value. 2041 PushOperand(r3); // Preserve value.
2039 VisitForAccumulatorValue(prop->obj()); 2042 VisitForAccumulatorValue(prop->obj());
2040 __ Move(StoreDescriptor::ReceiverRegister(), r3); 2043 __ Move(StoreDescriptor::ReceiverRegister(), r3);
2041 PopOperand(StoreDescriptor::ValueRegister()); // Restore value. 2044 PopOperand(StoreDescriptor::ValueRegister()); // Restore value.
2042 CallStoreIC(slot, prop->key()->AsLiteral()->value()); 2045 CallStoreIC(slot, prop->key()->AsLiteral()->value());
2043 break; 2046 break;
2044 } 2047 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 __ StoreP(result_register(), location, r0); 2102 __ StoreP(result_register(), location, r0);
2100 if (var->IsContextSlot()) { 2103 if (var->IsContextSlot()) {
2101 // RecordWrite may destroy all its register arguments. 2104 // RecordWrite may destroy all its register arguments.
2102 __ mr(r6, result_register()); 2105 __ mr(r6, result_register());
2103 int offset = Context::SlotOffset(var->index()); 2106 int offset = Context::SlotOffset(var->index());
2104 __ RecordWriteContextSlot(r4, offset, r6, r5, kLRHasBeenSaved, 2107 __ RecordWriteContextSlot(r4, offset, r6, r5, kLRHasBeenSaved,
2105 kDontSaveFPRegs); 2108 kDontSaveFPRegs);
2106 } 2109 }
2107 } 2110 }
2108 2111
2109
2110 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, 2112 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
2111 FeedbackVectorSlot slot) { 2113 FeedbackVectorSlot slot,
2114 HoleCheckMode hole_check_mode) {
2112 if (var->IsUnallocated()) { 2115 if (var->IsUnallocated()) {
2113 // Global var, const, or let. 2116 // Global var, const, or let.
2114 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); 2117 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister());
2115 CallStoreIC(slot, var->name()); 2118 CallStoreIC(slot, var->name());
2116 2119
2117 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) { 2120 } else if (IsLexicalVariableMode(var->mode()) && op != Token::INIT) {
2118 DCHECK(!var->IsLookupSlot()); 2121 DCHECK(!var->IsLookupSlot());
2119 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2122 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2120 MemOperand location = VarOperand(var, r4); 2123 MemOperand location = VarOperand(var, r4);
2121 // Perform an initialization check for lexically declared variables. 2124 // Perform an initialization check for lexically declared variables.
2122 if (var->binding_needs_init()) { 2125 if (hole_check_mode == HoleCheckMode::kRequired) {
2123 Label assign; 2126 Label assign;
2124 __ LoadP(r6, location); 2127 __ LoadP(r6, location);
2125 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex); 2128 __ CompareRoot(r6, Heap::kTheHoleValueRootIndex);
2126 __ bne(&assign); 2129 __ bne(&assign);
2127 __ mov(r6, Operand(var->name())); 2130 __ mov(r6, Operand(var->name()));
2128 __ push(r6); 2131 __ push(r6);
2129 __ CallRuntime(Runtime::kThrowReferenceError); 2132 __ CallRuntime(Runtime::kThrowReferenceError);
2130 __ bind(&assign); 2133 __ bind(&assign);
2131 } 2134 }
2132 if (var->mode() != CONST) { 2135 if (var->mode() != CONST) {
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
3180 3183
3181 SetExpressionPosition(expr); 3184 SetExpressionPosition(expr);
3182 3185
3183 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD).code(); 3186 Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD).code();
3184 CallIC(code, expr->CountBinOpFeedbackId()); 3187 CallIC(code, expr->CountBinOpFeedbackId());
3185 patch_site.EmitPatchInfo(); 3188 patch_site.EmitPatchInfo();
3186 __ bind(&done); 3189 __ bind(&done);
3187 3190
3188 // Store the value returned in r3. 3191 // Store the value returned in r3.
3189 switch (assign_type) { 3192 switch (assign_type) {
3190 case VARIABLE: 3193 case VARIABLE: {
3194 VariableProxy* proxy = expr->expression()->AsVariableProxy();
3191 if (expr->is_postfix()) { 3195 if (expr->is_postfix()) {
3192 { 3196 {
3193 EffectContext context(this); 3197 EffectContext context(this);
3194 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 3198 EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(),
3195 Token::ASSIGN, expr->CountSlot()); 3199 proxy->hole_check_mode());
3196 PrepareForBailoutForId(expr->AssignmentId(), 3200 PrepareForBailoutForId(expr->AssignmentId(),
3197 BailoutState::TOS_REGISTER); 3201 BailoutState::TOS_REGISTER);
3198 context.Plug(r3); 3202 context.Plug(r3);
3199 } 3203 }
3200 // For all contexts except EffectConstant We have the result on 3204 // For all contexts except EffectConstant We have the result on
3201 // top of the stack. 3205 // top of the stack.
3202 if (!context()->IsEffect()) { 3206 if (!context()->IsEffect()) {
3203 context()->PlugTOS(); 3207 context()->PlugTOS();
3204 } 3208 }
3205 } else { 3209 } else {
3206 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 3210 EmitVariableAssignment(proxy->var(), Token::ASSIGN, expr->CountSlot(),
3207 Token::ASSIGN, expr->CountSlot()); 3211 proxy->hole_check_mode());
3208 PrepareForBailoutForId(expr->AssignmentId(), 3212 PrepareForBailoutForId(expr->AssignmentId(),
3209 BailoutState::TOS_REGISTER); 3213 BailoutState::TOS_REGISTER);
3210 context()->Plug(r3); 3214 context()->Plug(r3);
3211 } 3215 }
3212 break; 3216 break;
3217 }
3213 case NAMED_PROPERTY: { 3218 case NAMED_PROPERTY: {
3214 PopOperand(StoreDescriptor::ReceiverRegister()); 3219 PopOperand(StoreDescriptor::ReceiverRegister());
3215 CallStoreIC(expr->CountSlot(), prop->key()->AsLiteral()->value()); 3220 CallStoreIC(expr->CountSlot(), prop->key()->AsLiteral()->value());
3216 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER); 3221 PrepareForBailoutForId(expr->AssignmentId(), BailoutState::TOS_REGISTER);
3217 if (expr->is_postfix()) { 3222 if (expr->is_postfix()) {
3218 if (!context()->IsEffect()) { 3223 if (!context()->IsEffect()) {
3219 context()->PlugTOS(); 3224 context()->PlugTOS();
3220 } 3225 }
3221 } else { 3226 } else {
3222 context()->Plug(r3); 3227 context()->Plug(r3);
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
3620 3625
3621 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); 3626 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address)));
3622 3627
3623 DCHECK(interrupt_address == 3628 DCHECK(interrupt_address ==
3624 isolate->builtins()->OnStackReplacement()->entry()); 3629 isolate->builtins()->OnStackReplacement()->entry());
3625 return ON_STACK_REPLACEMENT; 3630 return ON_STACK_REPLACEMENT;
3626 } 3631 }
3627 } // namespace internal 3632 } // namespace internal
3628 } // namespace v8 3633 } // namespace v8
3629 #endif // V8_TARGET_ARCH_PPC 3634 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen/s390/full-codegen-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698