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

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

Issue 2233673003: Remove CONST_LEGACY VariableMode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 3 months 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
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_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 // Perform an initialization check for lexically declared variables. 2066 // Perform an initialization check for lexically declared variables.
2067 if (var->binding_needs_init()) { 2067 if (var->binding_needs_init()) {
2068 Label assign; 2068 Label assign;
2069 __ mov(edx, location); 2069 __ mov(edx, location);
2070 __ cmp(edx, isolate()->factory()->the_hole_value()); 2070 __ cmp(edx, isolate()->factory()->the_hole_value());
2071 __ j(not_equal, &assign, Label::kNear); 2071 __ j(not_equal, &assign, Label::kNear);
2072 __ push(Immediate(var->name())); 2072 __ push(Immediate(var->name()));
2073 __ CallRuntime(Runtime::kThrowReferenceError); 2073 __ CallRuntime(Runtime::kThrowReferenceError);
2074 __ bind(&assign); 2074 __ bind(&assign);
2075 } 2075 }
2076 if (var->mode() == CONST) { 2076 if (var->mode() != CONST) {
2077 EmitStoreToStackLocalOrContextSlot(var, location);
2078 } else if (var->throw_on_const_assignment(language_mode())) {
2077 __ CallRuntime(Runtime::kThrowConstAssignError); 2079 __ CallRuntime(Runtime::kThrowConstAssignError);
2078 } else {
2079 EmitStoreToStackLocalOrContextSlot(var, location);
2080 } 2080 }
2081 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) { 2081 } else if (var->is_this() && var->mode() == CONST && op == Token::INIT) {
2082 // Initializing assignment to const {this} needs a write barrier. 2082 // Initializing assignment to const {this} needs a write barrier.
2083 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2083 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2084 Label uninitialized_this; 2084 Label uninitialized_this;
2085 MemOperand location = VarOperand(var, ecx); 2085 MemOperand location = VarOperand(var, ecx);
2086 __ mov(edx, location); 2086 __ mov(edx, location);
2087 __ cmp(edx, isolate()->factory()->the_hole_value()); 2087 __ cmp(edx, isolate()->factory()->the_hole_value());
2088 __ j(equal, &uninitialized_this); 2088 __ j(equal, &uninitialized_this);
2089 __ push(Immediate(var->name())); 2089 __ push(Immediate(var->name()));
2090 __ CallRuntime(Runtime::kThrowReferenceError); 2090 __ CallRuntime(Runtime::kThrowReferenceError);
2091 __ bind(&uninitialized_this); 2091 __ bind(&uninitialized_this);
2092 EmitStoreToStackLocalOrContextSlot(var, location); 2092 EmitStoreToStackLocalOrContextSlot(var, location);
2093 2093
2094 } else if (!var->is_const_mode() || op == Token::INIT) { 2094 } else {
2095 DCHECK(var->mode() != CONST || op == Token::INIT);
2095 if (var->IsLookupSlot()) { 2096 if (var->IsLookupSlot()) {
2096 // Assignment to var. 2097 // Assignment to var.
2097 __ Push(Immediate(var->name())); 2098 __ Push(Immediate(var->name()));
2098 __ Push(eax); 2099 __ Push(eax);
2099 __ CallRuntime(is_strict(language_mode()) 2100 __ CallRuntime(is_strict(language_mode())
2100 ? Runtime::kStoreLookupSlot_Strict 2101 ? Runtime::kStoreLookupSlot_Strict
2101 : Runtime::kStoreLookupSlot_Sloppy); 2102 : Runtime::kStoreLookupSlot_Sloppy);
2102 } else { 2103 } else {
2103 // Assignment to var or initializing assignment to let/const in harmony 2104 // Assignment to var or initializing assignment to let/const in harmony
2104 // mode. 2105 // mode.
2105 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2106 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2106 MemOperand location = VarOperand(var, ecx); 2107 MemOperand location = VarOperand(var, ecx);
2107 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) { 2108 if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
2108 // Check for an uninitialized let binding. 2109 // Check for an uninitialized let binding.
2109 __ mov(edx, location); 2110 __ mov(edx, location);
2110 __ cmp(edx, isolate()->factory()->the_hole_value()); 2111 __ cmp(edx, isolate()->factory()->the_hole_value());
2111 __ Check(equal, kLetBindingReInitialization); 2112 __ Check(equal, kLetBindingReInitialization);
2112 } 2113 }
2113 EmitStoreToStackLocalOrContextSlot(var, location); 2114 EmitStoreToStackLocalOrContextSlot(var, location);
2114 } 2115 }
2115
2116 } else {
2117 DCHECK(var->mode() == CONST_LEGACY && op != Token::INIT);
2118 if (is_strict(language_mode())) {
2119 __ CallRuntime(Runtime::kThrowConstAssignError);
2120 }
2121 // Silently ignore store in sloppy mode.
2122 } 2116 }
2123 } 2117 }
2124 2118
2125 2119
2126 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { 2120 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
2127 // Assignment to a property, using a named store IC. 2121 // Assignment to a property, using a named store IC.
2128 // eax : value 2122 // eax : value
2129 // esp[0] : receiver 2123 // esp[0] : receiver
2130 Property* prop = expr->target()->AsProperty(); 2124 Property* prop = expr->target()->AsProperty();
2131 DCHECK(prop != NULL); 2125 DCHECK(prop != NULL);
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3646 isolate->builtins()->OnStackReplacement()->entry(), 3640 isolate->builtins()->OnStackReplacement()->entry(),
3647 Assembler::target_address_at(call_target_address, unoptimized_code)); 3641 Assembler::target_address_at(call_target_address, unoptimized_code));
3648 return ON_STACK_REPLACEMENT; 3642 return ON_STACK_REPLACEMENT;
3649 } 3643 }
3650 3644
3651 3645
3652 } // namespace internal 3646 } // namespace internal
3653 } // namespace v8 3647 } // namespace v8
3654 3648
3655 #endif // V8_TARGET_ARCH_IA32 3649 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/arm64/full-codegen-arm64.cc ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698