| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 int num_parameters = info->scope()->num_parameters(); | 210 int num_parameters = info->scope()->num_parameters(); |
| 211 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; | 211 int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; |
| 212 for (int i = first_parameter; i < num_parameters; i++) { | 212 for (int i = first_parameter; i < num_parameters; i++) { |
| 213 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); | 213 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
| 214 if (var->IsContextSlot()) { | 214 if (var->IsContextSlot()) { |
| 215 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 215 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 216 (num_parameters - 1 - i) * kPointerSize; | 216 (num_parameters - 1 - i) * kPointerSize; |
| 217 // Load parameter from stack. | 217 // Load parameter from stack. |
| 218 __ lw(a0, MemOperand(fp, parameter_offset)); | 218 __ lw(a0, MemOperand(fp, parameter_offset)); |
| 219 // Store it in the context. | 219 // Store it in the context. |
| 220 MemOperand target = ContextMemOperand(cp, var->index()); | 220 MemOperand target = ContextOperand(cp, var->index()); |
| 221 __ sw(a0, target); | 221 __ sw(a0, target); |
| 222 | 222 |
| 223 // Update the write barrier. | 223 // Update the write barrier. |
| 224 if (need_write_barrier) { | 224 if (need_write_barrier) { |
| 225 __ RecordWriteContextSlot( | 225 __ RecordWriteContextSlot( |
| 226 cp, target.offset(), a0, a3, kRAHasBeenSaved, kDontSaveFPRegs); | 226 cp, target.offset(), a0, a3, kRAHasBeenSaved, kDontSaveFPRegs); |
| 227 } else if (FLAG_debug_code) { | 227 } else if (FLAG_debug_code) { |
| 228 Label done; | 228 Label done; |
| 229 __ JumpIfInNewSpace(cp, a0, &done); | 229 __ JumpIfInNewSpace(cp, a0, &done); |
| 230 __ Abort(kExpectedNewSpaceObject); | 230 __ Abort(kExpectedNewSpaceObject); |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 } | 707 } |
| 708 return MemOperand(fp, offset); | 708 return MemOperand(fp, offset); |
| 709 } | 709 } |
| 710 | 710 |
| 711 | 711 |
| 712 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { | 712 MemOperand FullCodeGenerator::VarOperand(Variable* var, Register scratch) { |
| 713 DCHECK(var->IsContextSlot() || var->IsStackAllocated()); | 713 DCHECK(var->IsContextSlot() || var->IsStackAllocated()); |
| 714 if (var->IsContextSlot()) { | 714 if (var->IsContextSlot()) { |
| 715 int context_chain_length = scope()->ContextChainLength(var->scope()); | 715 int context_chain_length = scope()->ContextChainLength(var->scope()); |
| 716 __ LoadContext(scratch, context_chain_length); | 716 __ LoadContext(scratch, context_chain_length); |
| 717 return ContextMemOperand(scratch, var->index()); | 717 return ContextOperand(scratch, var->index()); |
| 718 } else { | 718 } else { |
| 719 return StackOperand(var); | 719 return StackOperand(var); |
| 720 } | 720 } |
| 721 } | 721 } |
| 722 | 722 |
| 723 | 723 |
| 724 void FullCodeGenerator::GetVar(Register dest, Variable* var) { | 724 void FullCodeGenerator::GetVar(Register dest, Variable* var) { |
| 725 // Use destination as scratch. | 725 // Use destination as scratch. |
| 726 MemOperand location = VarOperand(var, dest); | 726 MemOperand location = VarOperand(var, dest); |
| 727 __ lw(dest, location); | 727 __ lw(dest, location); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); | 813 __ LoadRoot(t0, Heap::kTheHoleValueRootIndex); |
| 814 __ sw(t0, StackOperand(variable)); | 814 __ sw(t0, StackOperand(variable)); |
| 815 } | 815 } |
| 816 break; | 816 break; |
| 817 | 817 |
| 818 case VariableLocation::CONTEXT: | 818 case VariableLocation::CONTEXT: |
| 819 if (hole_init) { | 819 if (hole_init) { |
| 820 Comment cmnt(masm_, "[ VariableDeclaration"); | 820 Comment cmnt(masm_, "[ VariableDeclaration"); |
| 821 EmitDebugCheckDeclarationContext(variable); | 821 EmitDebugCheckDeclarationContext(variable); |
| 822 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 822 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 823 __ sw(at, ContextMemOperand(cp, variable->index())); | 823 __ sw(at, ContextOperand(cp, variable->index())); |
| 824 // No write barrier since the_hole_value is in old space. | 824 // No write barrier since the_hole_value is in old space. |
| 825 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); | 825 PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
| 826 } | 826 } |
| 827 break; | 827 break; |
| 828 | 828 |
| 829 case VariableLocation::LOOKUP: { | 829 case VariableLocation::LOOKUP: { |
| 830 Comment cmnt(masm_, "[ VariableDeclaration"); | 830 Comment cmnt(masm_, "[ VariableDeclaration"); |
| 831 __ li(a2, Operand(variable->name())); | 831 __ li(a2, Operand(variable->name())); |
| 832 // Declaration nodes are always introduced in one of four modes. | 832 // Declaration nodes are always introduced in one of four modes. |
| 833 DCHECK(IsDeclaredVariableMode(mode)); | 833 DCHECK(IsDeclaredVariableMode(mode)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 Comment cmnt(masm_, "[ FunctionDeclaration"); | 871 Comment cmnt(masm_, "[ FunctionDeclaration"); |
| 872 VisitForAccumulatorValue(declaration->fun()); | 872 VisitForAccumulatorValue(declaration->fun()); |
| 873 __ sw(result_register(), StackOperand(variable)); | 873 __ sw(result_register(), StackOperand(variable)); |
| 874 break; | 874 break; |
| 875 } | 875 } |
| 876 | 876 |
| 877 case VariableLocation::CONTEXT: { | 877 case VariableLocation::CONTEXT: { |
| 878 Comment cmnt(masm_, "[ FunctionDeclaration"); | 878 Comment cmnt(masm_, "[ FunctionDeclaration"); |
| 879 EmitDebugCheckDeclarationContext(variable); | 879 EmitDebugCheckDeclarationContext(variable); |
| 880 VisitForAccumulatorValue(declaration->fun()); | 880 VisitForAccumulatorValue(declaration->fun()); |
| 881 __ sw(result_register(), ContextMemOperand(cp, variable->index())); | 881 __ sw(result_register(), ContextOperand(cp, variable->index())); |
| 882 int offset = Context::SlotOffset(variable->index()); | 882 int offset = Context::SlotOffset(variable->index()); |
| 883 // We know that we have written a function, which is not a smi. | 883 // We know that we have written a function, which is not a smi. |
| 884 __ RecordWriteContextSlot(cp, | 884 __ RecordWriteContextSlot(cp, |
| 885 offset, | 885 offset, |
| 886 result_register(), | 886 result_register(), |
| 887 a2, | 887 a2, |
| 888 kRAHasBeenSaved, | 888 kRAHasBeenSaved, |
| 889 kDontSaveFPRegs, | 889 kDontSaveFPRegs, |
| 890 EMIT_REMEMBERED_SET, | 890 EMIT_REMEMBERED_SET, |
| 891 OMIT_SMI_CHECK); | 891 OMIT_SMI_CHECK); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 Label* slow) { | 1262 Label* slow) { |
| 1263 Register current = cp; | 1263 Register current = cp; |
| 1264 Register next = a1; | 1264 Register next = a1; |
| 1265 Register temp = a2; | 1265 Register temp = a2; |
| 1266 | 1266 |
| 1267 Scope* s = scope(); | 1267 Scope* s = scope(); |
| 1268 while (s != NULL) { | 1268 while (s != NULL) { |
| 1269 if (s->num_heap_slots() > 0) { | 1269 if (s->num_heap_slots() > 0) { |
| 1270 if (s->calls_sloppy_eval()) { | 1270 if (s->calls_sloppy_eval()) { |
| 1271 // Check that extension is NULL. | 1271 // Check that extension is NULL. |
| 1272 __ lw(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); | 1272 __ lw(temp, ContextOperand(current, Context::EXTENSION_INDEX)); |
| 1273 __ Branch(slow, ne, temp, Operand(zero_reg)); | 1273 __ Branch(slow, ne, temp, Operand(zero_reg)); |
| 1274 } | 1274 } |
| 1275 // Load next context in chain. | 1275 // Load next context in chain. |
| 1276 __ lw(next, ContextMemOperand(current, Context::PREVIOUS_INDEX)); | 1276 __ lw(next, ContextOperand(current, Context::PREVIOUS_INDEX)); |
| 1277 // Walk the rest of the chain without clobbering cp. | 1277 // Walk the rest of the chain without clobbering cp. |
| 1278 current = next; | 1278 current = next; |
| 1279 } | 1279 } |
| 1280 // If no outer scope calls eval, we do not need to check more | 1280 // If no outer scope calls eval, we do not need to check more |
| 1281 // context extensions. | 1281 // context extensions. |
| 1282 if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break; | 1282 if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break; |
| 1283 s = s->outer_scope(); | 1283 s = s->outer_scope(); |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 if (s->is_eval_scope()) { | 1286 if (s->is_eval_scope()) { |
| 1287 Label loop, fast; | 1287 Label loop, fast; |
| 1288 if (!current.is(next)) { | 1288 if (!current.is(next)) { |
| 1289 __ Move(next, current); | 1289 __ Move(next, current); |
| 1290 } | 1290 } |
| 1291 __ bind(&loop); | 1291 __ bind(&loop); |
| 1292 // Terminate at native context. | 1292 // Terminate at native context. |
| 1293 __ lw(temp, FieldMemOperand(next, HeapObject::kMapOffset)); | 1293 __ lw(temp, FieldMemOperand(next, HeapObject::kMapOffset)); |
| 1294 __ LoadRoot(t0, Heap::kNativeContextMapRootIndex); | 1294 __ LoadRoot(t0, Heap::kNativeContextMapRootIndex); |
| 1295 __ Branch(&fast, eq, temp, Operand(t0)); | 1295 __ Branch(&fast, eq, temp, Operand(t0)); |
| 1296 // Check that extension is NULL. | 1296 // Check that extension is NULL. |
| 1297 __ lw(temp, ContextMemOperand(next, Context::EXTENSION_INDEX)); | 1297 __ lw(temp, ContextOperand(next, Context::EXTENSION_INDEX)); |
| 1298 __ Branch(slow, ne, temp, Operand(zero_reg)); | 1298 __ Branch(slow, ne, temp, Operand(zero_reg)); |
| 1299 // Load next context in chain. | 1299 // Load next context in chain. |
| 1300 __ lw(next, ContextMemOperand(next, Context::PREVIOUS_INDEX)); | 1300 __ lw(next, ContextOperand(next, Context::PREVIOUS_INDEX)); |
| 1301 __ Branch(&loop); | 1301 __ Branch(&loop); |
| 1302 __ bind(&fast); | 1302 __ bind(&fast); |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 // All extension objects were empty and it is safe to use a normal global | 1305 // All extension objects were empty and it is safe to use a normal global |
| 1306 // load machinery. | 1306 // load machinery. |
| 1307 EmitGlobalVariableLoad(proxy, typeof_mode); | 1307 EmitGlobalVariableLoad(proxy, typeof_mode); |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 | 1310 |
| 1311 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1311 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
| 1312 Label* slow) { | 1312 Label* slow) { |
| 1313 DCHECK(var->IsContextSlot()); | 1313 DCHECK(var->IsContextSlot()); |
| 1314 Register context = cp; | 1314 Register context = cp; |
| 1315 Register next = a3; | 1315 Register next = a3; |
| 1316 Register temp = t0; | 1316 Register temp = t0; |
| 1317 | 1317 |
| 1318 for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { | 1318 for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { |
| 1319 if (s->num_heap_slots() > 0) { | 1319 if (s->num_heap_slots() > 0) { |
| 1320 if (s->calls_sloppy_eval()) { | 1320 if (s->calls_sloppy_eval()) { |
| 1321 // Check that extension is NULL. | 1321 // Check that extension is NULL. |
| 1322 __ lw(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); | 1322 __ lw(temp, ContextOperand(context, Context::EXTENSION_INDEX)); |
| 1323 __ Branch(slow, ne, temp, Operand(zero_reg)); | 1323 __ Branch(slow, ne, temp, Operand(zero_reg)); |
| 1324 } | 1324 } |
| 1325 __ lw(next, ContextMemOperand(context, Context::PREVIOUS_INDEX)); | 1325 __ lw(next, ContextOperand(context, Context::PREVIOUS_INDEX)); |
| 1326 // Walk the rest of the chain without clobbering cp. | 1326 // Walk the rest of the chain without clobbering cp. |
| 1327 context = next; | 1327 context = next; |
| 1328 } | 1328 } |
| 1329 } | 1329 } |
| 1330 // Check that last extension is NULL. | 1330 // Check that last extension is NULL. |
| 1331 __ lw(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); | 1331 __ lw(temp, ContextOperand(context, Context::EXTENSION_INDEX)); |
| 1332 __ Branch(slow, ne, temp, Operand(zero_reg)); | 1332 __ Branch(slow, ne, temp, Operand(zero_reg)); |
| 1333 | 1333 |
| 1334 // This function is used only for loads, not stores, so it's safe to | 1334 // This function is used only for loads, not stores, so it's safe to |
| 1335 // return an cp-based operand (the write barrier cannot be allowed to | 1335 // return an cp-based operand (the write barrier cannot be allowed to |
| 1336 // destroy the cp register). | 1336 // destroy the cp register). |
| 1337 return ContextMemOperand(context, var->index()); | 1337 return ContextOperand(context, var->index()); |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 | 1340 |
| 1341 void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, | 1341 void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, |
| 1342 TypeofMode typeof_mode, | 1342 TypeofMode typeof_mode, |
| 1343 Label* slow, Label* done) { | 1343 Label* slow, Label* done) { |
| 1344 // Generate fast-case code for variables that might be shadowed by | 1344 // Generate fast-case code for variables that might be shadowed by |
| 1345 // eval-introduced variables. Eval is used a lot without | 1345 // eval-introduced variables. Eval is used a lot without |
| 1346 // introducing variables. In those cases, we do not want to | 1346 // introducing variables. In those cases, we do not want to |
| 1347 // perform a runtime call for all variables in the scope | 1347 // perform a runtime call for all variables in the scope |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1370 __ Branch(done); | 1370 __ Branch(done); |
| 1371 } | 1371 } |
| 1372 } | 1372 } |
| 1373 | 1373 |
| 1374 | 1374 |
| 1375 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, | 1375 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
| 1376 TypeofMode typeof_mode) { | 1376 TypeofMode typeof_mode) { |
| 1377 Variable* var = proxy->var(); | 1377 Variable* var = proxy->var(); |
| 1378 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1378 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
| 1379 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1379 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
| 1380 __ LoadGlobalObject(LoadDescriptor::ReceiverRegister()); | 1380 __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 1381 __ li(LoadDescriptor::NameRegister(), Operand(var->name())); | 1381 __ li(LoadDescriptor::NameRegister(), Operand(var->name())); |
| 1382 __ li(LoadDescriptor::SlotRegister(), | 1382 __ li(LoadDescriptor::SlotRegister(), |
| 1383 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1383 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
| 1384 CallLoadIC(typeof_mode); | 1384 CallLoadIC(typeof_mode); |
| 1385 } | 1385 } |
| 1386 | 1386 |
| 1387 | 1387 |
| 1388 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, | 1388 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
| 1389 TypeofMode typeof_mode) { | 1389 TypeofMode typeof_mode) { |
| 1390 // Record position before possible IC call. | 1390 // Record position before possible IC call. |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 Label allocate, done_allocate; | 2177 Label allocate, done_allocate; |
| 2178 | 2178 |
| 2179 __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &allocate, TAG_OBJECT); | 2179 __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &allocate, TAG_OBJECT); |
| 2180 __ jmp(&done_allocate); | 2180 __ jmp(&done_allocate); |
| 2181 | 2181 |
| 2182 __ bind(&allocate); | 2182 __ bind(&allocate); |
| 2183 __ Push(Smi::FromInt(JSIteratorResult::kSize)); | 2183 __ Push(Smi::FromInt(JSIteratorResult::kSize)); |
| 2184 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | 2184 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
| 2185 | 2185 |
| 2186 __ bind(&done_allocate); | 2186 __ bind(&done_allocate); |
| 2187 __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, a1); | 2187 __ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
| 2188 __ lw(a1, FieldMemOperand(a1, JSGlobalObject::kNativeContextOffset)); |
| 2189 __ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 2188 __ pop(a2); | 2190 __ pop(a2); |
| 2189 __ LoadRoot(a3, | 2191 __ LoadRoot(a3, |
| 2190 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); | 2192 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); |
| 2191 __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex); | 2193 __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex); |
| 2192 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); | 2194 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); |
| 2193 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset)); | 2195 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
| 2194 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); | 2196 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); |
| 2195 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset)); | 2197 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset)); |
| 2196 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset)); | 2198 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset)); |
| 2197 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); | 2199 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2508 } | 2510 } |
| 2509 } | 2511 } |
| 2510 | 2512 |
| 2511 | 2513 |
| 2512 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, | 2514 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
| 2513 FeedbackVectorSlot slot) { | 2515 FeedbackVectorSlot slot) { |
| 2514 if (var->IsUnallocated()) { | 2516 if (var->IsUnallocated()) { |
| 2515 // Global var, const, or let. | 2517 // Global var, const, or let. |
| 2516 __ mov(StoreDescriptor::ValueRegister(), result_register()); | 2518 __ mov(StoreDescriptor::ValueRegister(), result_register()); |
| 2517 __ li(StoreDescriptor::NameRegister(), Operand(var->name())); | 2519 __ li(StoreDescriptor::NameRegister(), Operand(var->name())); |
| 2518 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister()); | 2520 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 2519 EmitLoadStoreICSlot(slot); | 2521 EmitLoadStoreICSlot(slot); |
| 2520 CallStoreIC(); | 2522 CallStoreIC(); |
| 2521 | 2523 |
| 2522 } else if (var->mode() == LET && op != Token::INIT) { | 2524 } else if (var->mode() == LET && op != Token::INIT) { |
| 2523 // Non-initializing assignment to let variable needs a write barrier. | 2525 // Non-initializing assignment to let variable needs a write barrier. |
| 2524 DCHECK(!var->IsLookupSlot()); | 2526 DCHECK(!var->IsLookupSlot()); |
| 2525 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2527 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
| 2526 Label assign; | 2528 Label assign; |
| 2527 MemOperand location = VarOperand(var, a1); | 2529 MemOperand location = VarOperand(var, a1); |
| 2528 __ lw(a3, location); | 2530 __ lw(a3, location); |
| (...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4129 | 4131 |
| 4130 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { | 4132 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { |
| 4131 ZoneList<Expression*>* args = expr->arguments(); | 4133 ZoneList<Expression*>* args = expr->arguments(); |
| 4132 DCHECK_EQ(2, args->length()); | 4134 DCHECK_EQ(2, args->length()); |
| 4133 VisitForStackValue(args->at(0)); | 4135 VisitForStackValue(args->at(0)); |
| 4134 VisitForStackValue(args->at(1)); | 4136 VisitForStackValue(args->at(1)); |
| 4135 | 4137 |
| 4136 Label runtime, done; | 4138 Label runtime, done; |
| 4137 | 4139 |
| 4138 __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &runtime, TAG_OBJECT); | 4140 __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &runtime, TAG_OBJECT); |
| 4139 __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, a1); | 4141 __ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
| 4142 __ lw(a1, FieldMemOperand(a1, JSGlobalObject::kNativeContextOffset)); |
| 4143 __ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX)); |
| 4140 __ Pop(a2, a3); | 4144 __ Pop(a2, a3); |
| 4141 __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex); | 4145 __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex); |
| 4142 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); | 4146 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); |
| 4143 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset)); | 4147 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
| 4144 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); | 4148 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); |
| 4145 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset)); | 4149 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset)); |
| 4146 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset)); | 4150 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset)); |
| 4147 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); | 4151 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); |
| 4148 __ jmp(&done); | 4152 __ jmp(&done); |
| 4149 | 4153 |
| 4150 __ bind(&runtime); | 4154 __ bind(&runtime); |
| 4151 __ CallRuntime(Runtime::kCreateIterResultObject, 2); | 4155 __ CallRuntime(Runtime::kCreateIterResultObject, 2); |
| 4152 | 4156 |
| 4153 __ bind(&done); | 4157 __ bind(&done); |
| 4154 context()->Plug(v0); | 4158 context()->Plug(v0); |
| 4155 } | 4159 } |
| 4156 | 4160 |
| 4157 | 4161 |
| 4158 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4162 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
| 4159 // Push undefined as the receiver. | 4163 // Push undefined as the receiver. |
| 4160 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | 4164 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); |
| 4161 __ push(v0); | 4165 __ push(v0); |
| 4162 | 4166 |
| 4163 __ LoadNativeContextSlot(expr->context_index(), v0); | 4167 __ lw(v0, GlobalObjectOperand()); |
| 4168 __ lw(v0, FieldMemOperand(v0, JSGlobalObject::kNativeContextOffset)); |
| 4169 __ lw(v0, ContextOperand(v0, expr->context_index())); |
| 4164 } | 4170 } |
| 4165 | 4171 |
| 4166 | 4172 |
| 4167 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4173 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
| 4168 ZoneList<Expression*>* args = expr->arguments(); | 4174 ZoneList<Expression*>* args = expr->arguments(); |
| 4169 int arg_count = args->length(); | 4175 int arg_count = args->length(); |
| 4170 | 4176 |
| 4171 SetCallPosition(expr, arg_count); | 4177 SetCallPosition(expr, arg_count); |
| 4172 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4178 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 4173 __ li(a0, Operand(arg_count)); | 4179 __ li(a0, Operand(arg_count)); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4244 : Runtime::kDeleteProperty_Sloppy, | 4250 : Runtime::kDeleteProperty_Sloppy, |
| 4245 2); | 4251 2); |
| 4246 context()->Plug(v0); | 4252 context()->Plug(v0); |
| 4247 } else if (proxy != NULL) { | 4253 } else if (proxy != NULL) { |
| 4248 Variable* var = proxy->var(); | 4254 Variable* var = proxy->var(); |
| 4249 // Delete of an unqualified identifier is disallowed in strict mode but | 4255 // Delete of an unqualified identifier is disallowed in strict mode but |
| 4250 // "delete this" is allowed. | 4256 // "delete this" is allowed. |
| 4251 bool is_this = var->HasThisName(isolate()); | 4257 bool is_this = var->HasThisName(isolate()); |
| 4252 DCHECK(is_sloppy(language_mode()) || is_this); | 4258 DCHECK(is_sloppy(language_mode()) || is_this); |
| 4253 if (var->IsUnallocatedOrGlobalSlot()) { | 4259 if (var->IsUnallocatedOrGlobalSlot()) { |
| 4254 __ LoadGlobalObject(a2); | 4260 __ lw(a2, GlobalObjectOperand()); |
| 4255 __ li(a1, Operand(var->name())); | 4261 __ li(a1, Operand(var->name())); |
| 4256 __ Push(a2, a1); | 4262 __ Push(a2, a1); |
| 4257 __ CallRuntime(Runtime::kDeleteProperty_Sloppy, 2); | 4263 __ CallRuntime(Runtime::kDeleteProperty_Sloppy, 2); |
| 4258 context()->Plug(v0); | 4264 context()->Plug(v0); |
| 4259 } else if (var->IsStackAllocated() || var->IsContextSlot()) { | 4265 } else if (var->IsStackAllocated() || var->IsContextSlot()) { |
| 4260 // Result of deleting non-global, non-dynamic variables is false. | 4266 // Result of deleting non-global, non-dynamic variables is false. |
| 4261 // The subexpression does not have side effects. | 4267 // The subexpression does not have side effects. |
| 4262 context()->Plug(is_this); | 4268 context()->Plug(is_this); |
| 4263 } else { | 4269 } else { |
| 4264 // Non-global variable. Call the runtime to try to delete from the | 4270 // Non-global variable. Call the runtime to try to delete from the |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4795 } | 4801 } |
| 4796 | 4802 |
| 4797 | 4803 |
| 4798 void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) { | 4804 void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) { |
| 4799 DCHECK_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset); | 4805 DCHECK_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset); |
| 4800 __ sw(value, MemOperand(fp, frame_offset)); | 4806 __ sw(value, MemOperand(fp, frame_offset)); |
| 4801 } | 4807 } |
| 4802 | 4808 |
| 4803 | 4809 |
| 4804 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { | 4810 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
| 4805 __ lw(dst, ContextMemOperand(cp, context_index)); | 4811 __ lw(dst, ContextOperand(cp, context_index)); |
| 4806 } | 4812 } |
| 4807 | 4813 |
| 4808 | 4814 |
| 4809 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { | 4815 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
| 4810 Scope* closure_scope = scope()->ClosureScope(); | 4816 Scope* closure_scope = scope()->ClosureScope(); |
| 4811 if (closure_scope->is_script_scope() || | 4817 if (closure_scope->is_script_scope() || |
| 4812 closure_scope->is_module_scope()) { | 4818 closure_scope->is_module_scope()) { |
| 4813 // Contexts nested in the native context have a canonical empty function | 4819 // Contexts nested in the native context have a canonical empty function |
| 4814 // as their closure, not the anonymous closure containing the global | 4820 // as their closure, not the anonymous closure containing the global |
| 4815 // code. | 4821 // code. |
| 4816 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, at); | 4822 __ lw(at, GlobalObjectOperand()); |
| 4823 __ lw(at, FieldMemOperand(at, JSGlobalObject::kNativeContextOffset)); |
| 4824 __ lw(at, ContextOperand(at, Context::CLOSURE_INDEX)); |
| 4817 } else if (closure_scope->is_eval_scope()) { | 4825 } else if (closure_scope->is_eval_scope()) { |
| 4818 // Contexts created by a call to eval have the same closure as the | 4826 // Contexts created by a call to eval have the same closure as the |
| 4819 // context calling eval, not the anonymous closure containing the eval | 4827 // context calling eval, not the anonymous closure containing the eval |
| 4820 // code. Fetch it from the context. | 4828 // code. Fetch it from the context. |
| 4821 __ lw(at, ContextMemOperand(cp, Context::CLOSURE_INDEX)); | 4829 __ lw(at, ContextOperand(cp, Context::CLOSURE_INDEX)); |
| 4822 } else { | 4830 } else { |
| 4823 DCHECK(closure_scope->is_function_scope()); | 4831 DCHECK(closure_scope->is_function_scope()); |
| 4824 __ lw(at, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 4832 __ lw(at, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 4825 } | 4833 } |
| 4826 __ push(at); | 4834 __ push(at); |
| 4827 } | 4835 } |
| 4828 | 4836 |
| 4829 | 4837 |
| 4830 // ---------------------------------------------------------------------------- | 4838 // ---------------------------------------------------------------------------- |
| 4831 // Non-local control flow support. | 4839 // Non-local control flow support. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4968 reinterpret_cast<uint32_t>( | 4976 reinterpret_cast<uint32_t>( |
| 4969 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4977 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4970 return OSR_AFTER_STACK_CHECK; | 4978 return OSR_AFTER_STACK_CHECK; |
| 4971 } | 4979 } |
| 4972 | 4980 |
| 4973 | 4981 |
| 4974 } // namespace internal | 4982 } // namespace internal |
| 4975 } // namespace v8 | 4983 } // namespace v8 |
| 4976 | 4984 |
| 4977 #endif // V8_TARGET_ARCH_MIPS | 4985 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |