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

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.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/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.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_IA32 5 #if V8_TARGET_ARCH_IA32
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 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); 2186 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3);
2187 // Not reached: the runtime call returns elsewhere. 2187 // Not reached: the runtime call returns elsewhere.
2188 __ Abort(kGeneratorFailedToResume); 2188 __ Abort(kGeneratorFailedToResume);
2189 2189
2190 __ bind(&done); 2190 __ bind(&done);
2191 context()->Plug(result_register()); 2191 context()->Plug(result_register());
2192 } 2192 }
2193 2193
2194 2194
2195 void FullCodeGenerator::EmitCreateIteratorResult(bool done) { 2195 void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
2196 Label gc_required; 2196 Label allocate, done_allocate;
2197 Label allocated;
2198 2197
2199 const int instance_size = 5 * kPointerSize; 2198 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &allocate, TAG_OBJECT);
2200 DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(), 2199 __ jmp(&done_allocate, Label::kNear);
2201 instance_size);
2202 2200
2203 __ Allocate(instance_size, eax, ecx, edx, &gc_required, TAG_OBJECT); 2201 __ bind(&allocate);
2204 __ jmp(&allocated); 2202 __ Push(Smi::FromInt(JSIteratorResult::kSize));
2203 __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
2205 2204
2206 __ bind(&gc_required); 2205 __ bind(&done_allocate);
2207 __ Push(Smi::FromInt(instance_size)); 2206 __ mov(ebx, GlobalObjectOperand());
2208 __ CallRuntime(Runtime::kAllocateInNewSpace, 1);
2209 __ mov(context_register(),
2210 Operand(ebp, StandardFrameConstants::kContextOffset));
2211
2212 __ bind(&allocated);
2213 __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
2214 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset)); 2207 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset));
2215 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); 2208 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX));
2216 __ pop(ecx);
2217 __ mov(edx, isolate()->factory()->ToBoolean(done));
2218 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); 2209 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx);
2219 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), 2210 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset),
2220 isolate()->factory()->empty_fixed_array()); 2211 isolate()->factory()->empty_fixed_array());
2221 __ mov(FieldOperand(eax, JSObject::kElementsOffset), 2212 __ mov(FieldOperand(eax, JSObject::kElementsOffset),
2222 isolate()->factory()->empty_fixed_array()); 2213 isolate()->factory()->empty_fixed_array());
2223 __ mov(FieldOperand(eax, JSGeneratorObject::kResultValuePropertyOffset), ecx); 2214 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset));
2224 __ mov(FieldOperand(eax, JSGeneratorObject::kResultDonePropertyOffset), edx); 2215 __ mov(FieldOperand(eax, JSIteratorResult::kDoneOffset),
2225 2216 isolate()->factory()->ToBoolean(done));
2226 // Only the value field needs a write barrier, as the other values are in the 2217 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
2227 // root set.
2228 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset,
2229 ecx, edx, kDontSaveFPRegs);
2230 } 2218 }
2231 2219
2232 2220
2233 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2221 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2234 SetExpressionPosition(prop); 2222 SetExpressionPosition(prop);
2235 Literal* key = prop->key()->AsLiteral(); 2223 Literal* key = prop->key()->AsLiteral();
2236 DCHECK(!key->value()->IsSmi()); 2224 DCHECK(!key->value()->IsSmi());
2237 DCHECK(!prop->IsSuperAccess()); 2225 DCHECK(!prop->IsSuperAccess());
2238 2226
2239 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); 2227 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value()));
(...skipping 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
4405 void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) { 4393 void FullCodeGenerator::EmitDebugIsActive(CallRuntime* expr) {
4406 DCHECK(expr->arguments()->length() == 0); 4394 DCHECK(expr->arguments()->length() == 0);
4407 ExternalReference debug_is_active = 4395 ExternalReference debug_is_active =
4408 ExternalReference::debug_is_active_address(isolate()); 4396 ExternalReference::debug_is_active_address(isolate());
4409 __ movzx_b(eax, Operand::StaticVariable(debug_is_active)); 4397 __ movzx_b(eax, Operand::StaticVariable(debug_is_active));
4410 __ SmiTag(eax); 4398 __ SmiTag(eax);
4411 context()->Plug(eax); 4399 context()->Plug(eax);
4412 } 4400 }
4413 4401
4414 4402
4403 void FullCodeGenerator::EmitCreateIterResultObject(CallRuntime* expr) {
4404 ZoneList<Expression*>* args = expr->arguments();
4405 DCHECK_EQ(2, args->length());
4406 VisitForStackValue(args->at(0));
4407 VisitForStackValue(args->at(1));
4408
4409 Label runtime, done;
4410
4411 __ Allocate(JSIteratorResult::kSize, eax, ecx, edx, &runtime, TAG_OBJECT);
4412 __ mov(ebx, GlobalObjectOperand());
4413 __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset));
4414 __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX));
4415 __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx);
4416 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset),
4417 isolate()->factory()->empty_fixed_array());
4418 __ mov(FieldOperand(eax, JSObject::kElementsOffset),
4419 isolate()->factory()->empty_fixed_array());
4420 __ pop(FieldOperand(eax, JSIteratorResult::kDoneOffset));
4421 __ pop(FieldOperand(eax, JSIteratorResult::kValueOffset));
4422 STATIC_ASSERT(JSIteratorResult::kSize == 5 * kPointerSize);
4423 __ jmp(&done, Label::kNear);
4424
4425 __ bind(&runtime);
4426 __ CallRuntime(Runtime::kCreateIterResultObject, 2);
4427
4428 __ bind(&done);
4429 context()->Plug(eax);
4430 }
4431
4432
4415 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 4433 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4416 // Push undefined as receiver. 4434 // Push undefined as receiver.
4417 __ push(Immediate(isolate()->factory()->undefined_value())); 4435 __ push(Immediate(isolate()->factory()->undefined_value()));
4418 4436
4419 __ mov(eax, GlobalObjectOperand()); 4437 __ mov(eax, GlobalObjectOperand());
4420 __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset)); 4438 __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset));
4421 __ mov(eax, ContextOperand(eax, expr->context_index())); 4439 __ mov(eax, ContextOperand(eax, expr->context_index()));
4422 } 4440 }
4423 4441
4424 4442
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
5231 Assembler::target_address_at(call_target_address, 5249 Assembler::target_address_at(call_target_address,
5232 unoptimized_code)); 5250 unoptimized_code));
5233 return OSR_AFTER_STACK_CHECK; 5251 return OSR_AFTER_STACK_CHECK;
5234 } 5252 }
5235 5253
5236 5254
5237 } // namespace internal 5255 } // namespace internal
5238 } // namespace v8 5256 } // namespace v8
5239 5257
5240 #endif // V8_TARGET_ARCH_IA32 5258 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698