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

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

Issue 1480003002: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add patch from Orion for interpreter cementation test. Disable obsolete/invalid tests. Created 5 years 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_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
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 = ContextOperand(cp, var->index()); 220 MemOperand target = ContextMemOperand(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
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 ContextOperand(scratch, var->index()); 717 return ContextMemOperand(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
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, ContextOperand(cp, variable->index())); 823 __ sw(at, ContextMemOperand(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
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(), ContextOperand(cp, variable->index())); 881 __ sw(result_register(), ContextMemOperand(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
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, ContextOperand(current, Context::EXTENSION_INDEX)); 1272 __ lw(temp, ContextMemOperand(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, ContextOperand(current, Context::PREVIOUS_INDEX)); 1276 __ lw(next, ContextMemOperand(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, ContextOperand(next, Context::EXTENSION_INDEX)); 1297 __ lw(temp, ContextMemOperand(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, ContextOperand(next, Context::PREVIOUS_INDEX)); 1300 __ lw(next, ContextMemOperand(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, ContextOperand(context, Context::EXTENSION_INDEX)); 1322 __ lw(temp, ContextMemOperand(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, ContextOperand(context, Context::PREVIOUS_INDEX)); 1325 __ lw(next, ContextMemOperand(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, ContextOperand(context, Context::EXTENSION_INDEX)); 1331 __ lw(temp, ContextMemOperand(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 ContextOperand(context, var->index()); 1337 return ContextMemOperand(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
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 __ lw(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1380 __ LoadGlobalObject(LoadDescriptor::ReceiverRegister());
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
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 __ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); 2187 __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, a1);
2188 __ lw(a1, FieldMemOperand(a1, JSGlobalObject::kNativeContextOffset));
2189 __ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
2190 __ pop(a2); 2188 __ pop(a2);
2191 __ LoadRoot(a3, 2189 __ LoadRoot(a3,
2192 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex); 2190 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex);
2193 __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex); 2191 __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex);
2194 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); 2192 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
2195 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset)); 2193 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
2196 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); 2194 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
2197 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset)); 2195 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset));
2198 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset)); 2196 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset));
2199 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); 2197 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 } 2508 }
2511 } 2509 }
2512 2510
2513 2511
2514 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, 2512 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
2515 FeedbackVectorSlot slot) { 2513 FeedbackVectorSlot slot) {
2516 if (var->IsUnallocated()) { 2514 if (var->IsUnallocated()) {
2517 // Global var, const, or let. 2515 // Global var, const, or let.
2518 __ mov(StoreDescriptor::ValueRegister(), result_register()); 2516 __ mov(StoreDescriptor::ValueRegister(), result_register());
2519 __ li(StoreDescriptor::NameRegister(), Operand(var->name())); 2517 __ li(StoreDescriptor::NameRegister(), Operand(var->name()));
2520 __ lw(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); 2518 __ LoadGlobalObject(StoreDescriptor::ReceiverRegister());
2521 EmitLoadStoreICSlot(slot); 2519 EmitLoadStoreICSlot(slot);
2522 CallStoreIC(); 2520 CallStoreIC();
2523 2521
2524 } else if (var->mode() == LET && op != Token::INIT) { 2522 } else if (var->mode() == LET && op != Token::INIT) {
2525 // Non-initializing assignment to let variable needs a write barrier. 2523 // Non-initializing assignment to let variable needs a write barrier.
2526 DCHECK(!var->IsLookupSlot()); 2524 DCHECK(!var->IsLookupSlot());
2527 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2525 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2528 Label assign; 2526 Label assign;
2529 MemOperand location = VarOperand(var, a1); 2527 MemOperand location = VarOperand(var, a1);
2530 __ lw(a3, location); 2528 __ lw(a3, location);
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
4131 4129
4132 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) { 4130 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
4133 ZoneList<Expression*>* args = expr->arguments(); 4131 ZoneList<Expression*>* args = expr->arguments();
4134 DCHECK_EQ(2, args->length()); 4132 DCHECK_EQ(2, args->length());
4135 VisitForStackValue(args->at(0)); 4133 VisitForStackValue(args->at(0));
4136 VisitForStackValue(args->at(1)); 4134 VisitForStackValue(args->at(1));
4137 4135
4138 Label runtime, done; 4136 Label runtime, done;
4139 4137
4140 __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &runtime, TAG_OBJECT); 4138 __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &runtime, TAG_OBJECT);
4141 __ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); 4139 __ LoadNativeContextSlot(Context::ITERATOR_RESULT_MAP_INDEX, a1);
4142 __ lw(a1, FieldMemOperand(a1, JSGlobalObject::kNativeContextOffset));
4143 __ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
4144 __ Pop(a2, a3); 4140 __ Pop(a2, a3);
4145 __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex); 4141 __ LoadRoot(t0, Heap::kEmptyFixedArrayRootIndex);
4146 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); 4142 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
4147 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset)); 4143 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
4148 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); 4144 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
4149 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset)); 4145 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset));
4150 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset)); 4146 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset));
4151 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize); 4147 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
4152 __ jmp(&done); 4148 __ jmp(&done);
4153 4149
4154 __ bind(&runtime); 4150 __ bind(&runtime);
4155 __ CallRuntime(Runtime::kCreateIterResultObject, 2); 4151 __ CallRuntime(Runtime::kCreateIterResultObject, 2);
4156 4152
4157 __ bind(&done); 4153 __ bind(&done);
4158 context()->Plug(v0); 4154 context()->Plug(v0);
4159 } 4155 }
4160 4156
4161 4157
4162 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 4158 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4163 // Push undefined as the receiver. 4159 // Push undefined as the receiver.
4164 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 4160 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
4165 __ push(v0); 4161 __ push(v0);
4166 4162
4167 __ lw(v0, GlobalObjectOperand()); 4163 __ LoadNativeContextSlot(expr->context_index(), v0);
4168 __ lw(v0, FieldMemOperand(v0, JSGlobalObject::kNativeContextOffset));
4169 __ lw(v0, ContextOperand(v0, expr->context_index()));
4170 } 4164 }
4171 4165
4172 4166
4173 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 4167 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
4174 ZoneList<Expression*>* args = expr->arguments(); 4168 ZoneList<Expression*>* args = expr->arguments();
4175 int arg_count = args->length(); 4169 int arg_count = args->length();
4176 4170
4177 SetCallPosition(expr, arg_count); 4171 SetCallPosition(expr, arg_count);
4178 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 4172 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
4179 __ li(a0, Operand(arg_count)); 4173 __ li(a0, Operand(arg_count));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
4250 : Runtime::kDeleteProperty_Sloppy, 4244 : Runtime::kDeleteProperty_Sloppy,
4251 2); 4245 2);
4252 context()->Plug(v0); 4246 context()->Plug(v0);
4253 } else if (proxy != NULL) { 4247 } else if (proxy != NULL) {
4254 Variable* var = proxy->var(); 4248 Variable* var = proxy->var();
4255 // Delete of an unqualified identifier is disallowed in strict mode but 4249 // Delete of an unqualified identifier is disallowed in strict mode but
4256 // "delete this" is allowed. 4250 // "delete this" is allowed.
4257 bool is_this = var->HasThisName(isolate()); 4251 bool is_this = var->HasThisName(isolate());
4258 DCHECK(is_sloppy(language_mode()) || is_this); 4252 DCHECK(is_sloppy(language_mode()) || is_this);
4259 if (var->IsUnallocatedOrGlobalSlot()) { 4253 if (var->IsUnallocatedOrGlobalSlot()) {
4260 __ lw(a2, GlobalObjectOperand()); 4254 __ LoadGlobalObject(a2);
4261 __ li(a1, Operand(var->name())); 4255 __ li(a1, Operand(var->name()));
4262 __ Push(a2, a1); 4256 __ Push(a2, a1);
4263 __ CallRuntime(Runtime::kDeleteProperty_Sloppy, 2); 4257 __ CallRuntime(Runtime::kDeleteProperty_Sloppy, 2);
4264 context()->Plug(v0); 4258 context()->Plug(v0);
4265 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 4259 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
4266 // Result of deleting non-global, non-dynamic variables is false. 4260 // Result of deleting non-global, non-dynamic variables is false.
4267 // The subexpression does not have side effects. 4261 // The subexpression does not have side effects.
4268 context()->Plug(is_this); 4262 context()->Plug(is_this);
4269 } else { 4263 } else {
4270 // Non-global variable. Call the runtime to try to delete from the 4264 // Non-global variable. Call the runtime to try to delete from the
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
4801 } 4795 }
4802 4796
4803 4797
4804 void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) { 4798 void FullCodeGenerator::StoreToFrameField(int frame_offset, Register value) {
4805 DCHECK_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset); 4799 DCHECK_EQ(POINTER_SIZE_ALIGN(frame_offset), frame_offset);
4806 __ sw(value, MemOperand(fp, frame_offset)); 4800 __ sw(value, MemOperand(fp, frame_offset));
4807 } 4801 }
4808 4802
4809 4803
4810 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 4804 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
4811 __ lw(dst, ContextOperand(cp, context_index)); 4805 __ lw(dst, ContextMemOperand(cp, context_index));
4812 } 4806 }
4813 4807
4814 4808
4815 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 4809 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
4816 Scope* closure_scope = scope()->ClosureScope(); 4810 Scope* closure_scope = scope()->ClosureScope();
4817 if (closure_scope->is_script_scope() || 4811 if (closure_scope->is_script_scope() ||
4818 closure_scope->is_module_scope()) { 4812 closure_scope->is_module_scope()) {
4819 // Contexts nested in the native context have a canonical empty function 4813 // Contexts nested in the native context have a canonical empty function
4820 // as their closure, not the anonymous closure containing the global 4814 // as their closure, not the anonymous closure containing the global
4821 // code. 4815 // code.
4822 __ lw(at, GlobalObjectOperand()); 4816 __ LoadNativeContextSlot(Context::CLOSURE_INDEX, at);
4823 __ lw(at, FieldMemOperand(at, JSGlobalObject::kNativeContextOffset));
4824 __ lw(at, ContextOperand(at, Context::CLOSURE_INDEX));
4825 } else if (closure_scope->is_eval_scope()) { 4817 } else if (closure_scope->is_eval_scope()) {
4826 // Contexts created by a call to eval have the same closure as the 4818 // Contexts created by a call to eval have the same closure as the
4827 // context calling eval, not the anonymous closure containing the eval 4819 // context calling eval, not the anonymous closure containing the eval
4828 // code. Fetch it from the context. 4820 // code. Fetch it from the context.
4829 __ lw(at, ContextOperand(cp, Context::CLOSURE_INDEX)); 4821 __ lw(at, ContextMemOperand(cp, Context::CLOSURE_INDEX));
4830 } else { 4822 } else {
4831 DCHECK(closure_scope->is_function_scope()); 4823 DCHECK(closure_scope->is_function_scope());
4832 __ lw(at, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 4824 __ lw(at, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
4833 } 4825 }
4834 __ push(at); 4826 __ push(at);
4835 } 4827 }
4836 4828
4837 4829
4838 // ---------------------------------------------------------------------------- 4830 // ----------------------------------------------------------------------------
4839 // Non-local control flow support. 4831 // Non-local control flow support.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
4977 reinterpret_cast<uint32_t>( 4969 reinterpret_cast<uint32_t>(
4978 isolate->builtins()->OsrAfterStackCheck()->entry())); 4970 isolate->builtins()->OsrAfterStackCheck()->entry()));
4979 return OSR_AFTER_STACK_CHECK; 4971 return OSR_AFTER_STACK_CHECK;
4980 } 4972 }
4981 4973
4982 4974
4983 } // namespace internal 4975 } // namespace internal
4984 } // namespace v8 4976 } // namespace v8
4985 4977
4986 #endif // V8_TARGET_ARCH_MIPS 4978 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/full-codegen/ia32/full-codegen-ia32.cc ('k') | src/full-codegen/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698