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

Side by Side Diff: src/full-codegen/x64/full-codegen-x64.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
« no previous file with comments | « src/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/heap/objects-visiting.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 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_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); 2210 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3);
2211 // Not reached: the runtime call returns elsewhere. 2211 // Not reached: the runtime call returns elsewhere.
2212 __ Abort(kGeneratorFailedToResume); 2212 __ Abort(kGeneratorFailedToResume);
2213 2213
2214 __ bind(&done); 2214 __ bind(&done);
2215 context()->Plug(result_register()); 2215 context()->Plug(result_register());
2216 } 2216 }
2217 2217
2218 2218
2219 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { 2219 void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
2220 Label gc_required; 2220 Label allocate, done_allocate;
2221 Label allocated;
2222 2221
2223 const int instance_size = 5 * kPointerSize; 2222 __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &allocate, TAG_OBJECT);
2224 DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(), 2223 __ jmp(&done_allocate, Label::kNear);
2225 instance_size);
2226 2224
2227 __ Allocate(instance_size, rax, rcx, rdx, &gc_required, TAG_OBJECT); 2225 __ bind(&allocate);
2228 __ jmp(&allocated); 2226 __ Push(Smi::FromInt(JSIteratorResult::kSize));
2227 __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
2229 2228
2230 __ bind(&gc_required); 2229 __ bind(&done_allocate);
2231 __ Push(Smi::FromInt(instance_size)); 2230 __ movp(rbx, GlobalObjectOperand());
2232 __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
2233 __ movp(context_register(),
2234 Operand(rbp, StandardFrameConstants::kContextOffset));
2235
2236 __ bind(&allocated);
2237 __ movp(rbx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
2238 __ movp(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset)); 2231 __ movp(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset));
2239 __ movp(rbx, ContextOperand(rbx, Context::ITERATOR_RESULT_MAP_INDEX)); 2232 __ movp(rbx, ContextOperand(rbx, Context::ITERATOR_RESULT_MAP_INDEX));
2240 __ Pop(rcx);
2241 __ Move(rdx, isolate()->factory()->ToBoolean(done));
2242 __ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx); 2233 __ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx);
2243 __ Move(FieldOperand(rax, JSObject::kPropertiesOffset), 2234 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex);
2244 isolate()->factory()->empty_fixed_array()); 2235 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx);
2245 __ Move(FieldOperand(rax, JSObject::kElementsOffset), 2236 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx);
2246 isolate()->factory()->empty_fixed_array()); 2237 __ Pop(FieldOperand(rax, JSIteratorResult::kValueOffset));
2247 __ movp(FieldOperand(rax, JSGeneratorObject::kResultValuePropertyOffset), 2238 __ LoadRoot(FieldOperand(rax, JSIteratorResult::kDoneOffset),
2248 rcx); 2239 done ? Heap::kTrueValueRootIndex : Heap::kFalseValueRootIndex);
2249 __ movp(FieldOperand(rax, JSGeneratorObject::kResultDonePropertyOffset), 2240 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
2250 rdx);
2251
2252 // Only the value field needs a write barrier, as the other values are in the
2253 // root set.
2254 __ RecordWriteField(rax, JSGeneratorObject::kResultValuePropertyOffset,
2255 rcx, rdx, kDontSaveFPRegs);
2256 } 2241 }
2257 2242
2258 2243
2259 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2244 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2260 SetExpressionPosition(prop); 2245 SetExpressionPosition(prop);
2261 Literal* key = prop->key()->AsLiteral(); 2246 Literal* key = prop->key()->AsLiteral();
2262 DCHECK(!prop->IsSuperAccess()); 2247 DCHECK(!prop->IsSuperAccess());
2263 2248
2264 __ Move(LoadDescriptor::NameRegister(), key->value()); 2249 __ Move(LoadDescriptor::NameRegister(), key->value());
2265 __ Move(LoadDescriptor::SlotRegister(), 2250 __ Move(LoadDescriptor::SlotRegister(),
(...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after
4416 DCHECK(expr->arguments()->length() == 0); 4401 DCHECK(expr->arguments()->length() == 0);
4417 ExternalReference debug_is_active = 4402 ExternalReference debug_is_active =
4418 ExternalReference::debug_is_active_address(isolate()); 4403 ExternalReference::debug_is_active_address(isolate());
4419 __ Move(kScratchRegister, debug_is_active); 4404 __ Move(kScratchRegister, debug_is_active);
4420 __ movzxbp(rax, Operand(kScratchRegister, 0)); 4405 __ movzxbp(rax, Operand(kScratchRegister, 0));
4421 __ Integer32ToSmi(rax, rax); 4406 __ Integer32ToSmi(rax, rax);
4422 context()->Plug(rax); 4407 context()->Plug(rax);
4423 } 4408 }
4424 4409
4425 4410
4411 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
4412 ZoneList<Expression*>* args = expr->arguments();
4413 DCHECK_EQ(2, args->length());
4414 VisitForStackValue(args->at(0));
4415 VisitForStackValue(args->at(1));
4416
4417 Label runtime, done;
4418
4419 __ Allocate(JSIteratorResult::kSize, rax, rcx, rdx, &runtime, TAG_OBJECT);
4420 __ movp(rbx, GlobalObjectOperand());
4421 __ movp(rbx, FieldOperand(rbx, GlobalObject::kNativeContextOffset));
4422 __ movp(rbx, ContextOperand(rbx, Context::ITERATOR_RESULT_MAP_INDEX));
4423 __ movp(FieldOperand(rax, HeapObject::kMapOffset), rbx);
4424 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex);
4425 __ movp(FieldOperand(rax, JSObject::kPropertiesOffset), rbx);
4426 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rbx);
4427 __ Pop(FieldOperand(rax, JSIteratorResult::kDoneOffset));
4428 __ Pop(FieldOperand(rax, JSIteratorResult::kValueOffset));
4429 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
4430 __ jmp(&done, Label::kNear);
4431
4432 __ bind(&runtime);
4433 __ CallRuntime(Runtime::kCreateIterResultObject, 2);
4434
4435 __ bind(&done);
4436 context()->Plug(rax);
4437 }
4438
4439
4426 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 4440 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4427 // Push the builtins object as receiver. 4441 // Push the builtins object as receiver.
4428 __ PushRoot(Heap::kUndefinedValueRootIndex); 4442 __ PushRoot(Heap::kUndefinedValueRootIndex);
4429 4443
4430 __ movp(rax, GlobalObjectOperand()); 4444 __ movp(rax, GlobalObjectOperand());
4431 __ movp(rax, FieldOperand(rax, GlobalObject::kNativeContextOffset)); 4445 __ movp(rax, FieldOperand(rax, GlobalObject::kNativeContextOffset));
4432 __ movp(rax, ContextOperand(rax, expr->context_index())); 4446 __ movp(rax, ContextOperand(rax, expr->context_index()));
4433 } 4447 }
4434 4448
4435 4449
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
5241 Assembler::target_address_at(call_target_address, 5255 Assembler::target_address_at(call_target_address,
5242 unoptimized_code)); 5256 unoptimized_code));
5243 return OSR_AFTER_STACK_CHECK; 5257 return OSR_AFTER_STACK_CHECK;
5244 } 5258 }
5245 5259
5246 5260
5247 } // namespace internal 5261 } // namespace internal
5248 } // namespace v8 5262 } // namespace v8
5249 5263
5250 #endif // V8_TARGET_ARCH_X64 5264 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698