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

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

Issue 1302173007: [es6] Introduce a dedicated JSIteratorResult type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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_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 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); 2259 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3);
2260 // Not reached: the runtime call returns elsewhere. 2260 // Not reached: the runtime call returns elsewhere.
2261 __ stop("not-reached"); 2261 __ stop("not-reached");
2262 2262
2263 __ bind(&done); 2263 __ bind(&done);
2264 context()->Plug(result_register()); 2264 context()->Plug(result_register());
2265 } 2265 }
2266 2266
2267 2267
2268 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { 2268 void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
2269 Label gc_required; 2269 Label allocate, done_allocate;
2270 Label allocated;
2271 2270
2272 const int instance_size = 5 * kPointerSize; 2271 __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &allocate, TAG_OBJECT);
2273 DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(), 2272 __ jmp(&done_allocate);
2274 instance_size);
2275 2273
2276 __ Allocate(instance_size, v0, a2, a3, &gc_required, TAG_OBJECT); 2274 __ bind(&allocate);
2277 __ jmp(&allocated); 2275 __ Push(Smi::FromInt(JSIteratorResult::kSize));
2276 __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
2278 2277
2279 __ bind(&gc_required); 2278 __ bind(&done_allocate);
2280 __ Push(Smi::FromInt(instance_size));
2281 __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
2282 __ lw(context_register(),
2283 MemOperand(fp, StandardFrameConstants::kContextOffset));
2284
2285 __ bind(&allocated);
2286 __ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); 2279 __ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
2287 __ lw(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset)); 2280 __ lw(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset));
2288 __ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX)); 2281 __ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
2289 __ pop(a2); 2282 __ pop(a2);
2290 __ li(a3, Operand(isolate()->factory()->ToBoolean(done))); 2283 __ li(a3, Operand(isolate()->factory()->ToBoolean(done)));
2291 __ li(t0, Operand(isolate()->factory()->empty_fixed_array())); 2284 __ li(t0, Operand(isolate()->factory()->empty_fixed_array()));
2292 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); 2285 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
2293 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset)); 2286 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
2294 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); 2287 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
2295 __ sw(a2, 2288 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset));
2296 FieldMemOperand(v0, JSGeneratorObject::kResultValuePropertyOffset)); 2289 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset));
2297 __ sw(a3, 2290 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
2298 FieldMemOperand(v0, JSGeneratorObject::kResultDonePropertyOffset));
2299
2300 // Only the value field needs a write barrier, as the other values are in the
2301 // root set.
2302 __ RecordWriteField(v0, JSGeneratorObject::kResultValuePropertyOffset,
2303 a2, a3, kRAHasBeenSaved, kDontSaveFPRegs);
2304 } 2291 }
2305 2292
2306 2293
2307 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2294 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2308 SetExpressionPosition(prop); 2295 SetExpressionPosition(prop);
2309 Literal* key = prop->key()->AsLiteral(); 2296 Literal* key = prop->key()->AsLiteral();
2310 DCHECK(!prop->IsSuperAccess()); 2297 DCHECK(!prop->IsSuperAccess());
2311 2298
2312 __ li(LoadDescriptor::NameRegister(), Operand(key->value())); 2299 __ li(LoadDescriptor::NameRegister(), Operand(key->value()));
2313 __ li(LoadDescriptor::SlotRegister(), 2300 __ li(LoadDescriptor::SlotRegister(),
(...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after
4492 DCHECK(expr->arguments()->length() == 0); 4479 DCHECK(expr->arguments()->length() == 0);
4493 ExternalReference debug_is_active = 4480 ExternalReference debug_is_active =
4494 ExternalReference::debug_is_active_address(isolate()); 4481 ExternalReference::debug_is_active_address(isolate());
4495 __ li(at, Operand(debug_is_active)); 4482 __ li(at, Operand(debug_is_active));
4496 __ lb(v0, MemOperand(at)); 4483 __ lb(v0, MemOperand(at));
4497 __ SmiTag(v0); 4484 __ SmiTag(v0);
4498 context()->Plug(v0); 4485 context()->Plug(v0);
4499 } 4486 }
4500 4487
4501 4488
4489 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
4490 ZoneList<Expression*>* args = expr->arguments();
4491 DCHECK_EQ(2, args->length());
4492 VisitForStackValue(args->at(0));
4493 VisitForStackValue(args->at(1));
4494
4495 Label runtime, done;
4496
4497 __ Allocate(JSIteratorResult::kSize, v0, a2, a3, &runtime, TAG_OBJECT);
4498 __ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
4499 __ lw(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset));
4500 __ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX));
4501 __ pop(a3);
4502 __ pop(a2);
4503 __ li(t0, Operand(isolate()->factory()->empty_fixed_array()));
4504 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset));
4505 __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset));
4506 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset));
4507 __ sw(a2, FieldMemOperand(v0, JSIteratorResult::kValueOffset));
4508 __ sw(a3, FieldMemOperand(v0, JSIteratorResult::kDoneOffset));
4509 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
4510 __ jmp(&done);
4511
4512 __ bind(&runtime);
4513 __ CallRuntime(Runtime::kCreateIterResultObject, 2);
4514
4515 __ bind(&done);
4516 context()->Plug(v0);
4517 }
4518
4519
4502 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 4520 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4503 // Push undefined as the receiver. 4521 // Push undefined as the receiver.
4504 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 4522 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
4505 __ push(v0); 4523 __ push(v0);
4506 4524
4507 __ lw(v0, GlobalObjectOperand()); 4525 __ lw(v0, GlobalObjectOperand());
4508 __ lw(v0, FieldMemOperand(v0, GlobalObject::kNativeContextOffset)); 4526 __ lw(v0, FieldMemOperand(v0, GlobalObject::kNativeContextOffset));
4509 __ lw(v0, ContextOperand(v0, expr->context_index())); 4527 __ lw(v0, ContextOperand(v0, expr->context_index()));
4510 } 4528 }
4511 4529
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
5321 reinterpret_cast<uint32_t>( 5339 reinterpret_cast<uint32_t>(
5322 isolate->builtins()->OsrAfterStackCheck()->entry())); 5340 isolate->builtins()->OsrAfterStackCheck()->entry()));
5323 return OSR_AFTER_STACK_CHECK; 5341 return OSR_AFTER_STACK_CHECK;
5324 } 5342 }
5325 5343
5326 5344
5327 } // namespace internal 5345 } // namespace internal
5328 } // namespace v8 5346 } // namespace v8
5329 5347
5330 #endif // V8_TARGET_ARCH_MIPS 5348 #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