| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 5293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5304 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); | 5304 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset)); |
| 5305 // Load the map's "bit field 2". We only need the first byte, | 5305 // Load the map's "bit field 2". We only need the first byte, |
| 5306 // but the following masking takes care of that anyway. | 5306 // but the following masking takes care of that anyway. |
| 5307 __ mov(ebx, FieldOperand(ebx, Map::kBitField2Offset)); | 5307 __ mov(ebx, FieldOperand(ebx, Map::kBitField2Offset)); |
| 5308 // Retrieve elements_kind from bit field 2. | 5308 // Retrieve elements_kind from bit field 2. |
| 5309 __ and_(ebx, Map::kElementsKindMask); | 5309 __ and_(ebx, Map::kElementsKindMask); |
| 5310 __ cmp(ebx, boilerplate_elements_kind << Map::kElementsKindShift); | 5310 __ cmp(ebx, boilerplate_elements_kind << Map::kElementsKindShift); |
| 5311 DeoptimizeIf(not_equal, instr->environment()); | 5311 DeoptimizeIf(not_equal, instr->environment()); |
| 5312 } | 5312 } |
| 5313 | 5313 |
| 5314 int flags = allocation_site_mode == TRACK_ALLOCATION_SITE |
| 5315 ? ArrayLiteral::kAllocationSiteInfoAllowed |
| 5316 : ArrayLiteral::kNoFlags; |
| 5317 |
| 5314 // Set up the parameters to the stub/runtime call. | 5318 // Set up the parameters to the stub/runtime call. |
| 5315 __ PushHeapObject(literals); | 5319 __ PushHeapObject(literals); |
| 5316 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5320 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| 5317 // Boilerplate already exists, constant elements are never accessed. | 5321 // Boilerplate already exists, constant elements are never accessed. |
| 5318 // Pass an empty fixed array. | 5322 // Pass an empty fixed array. |
| 5319 __ push(Immediate(isolate()->factory()->empty_fixed_array())); | 5323 __ push(Immediate(isolate()->factory()->empty_fixed_array())); |
| 5324 __ push(Immediate(Smi::FromInt(flags))); |
| 5320 | 5325 |
| 5321 // Pick the right runtime function or stub to call. | 5326 // Pick the right runtime function or stub to call. |
| 5322 int length = instr->hydrogen()->length(); | 5327 int length = instr->hydrogen()->length(); |
| 5323 if (instr->hydrogen()->IsCopyOnWrite()) { | 5328 if (instr->hydrogen()->IsCopyOnWrite()) { |
| 5324 ASSERT(instr->hydrogen()->depth() == 1); | 5329 ASSERT(instr->hydrogen()->depth() == 1); |
| 5325 FastCloneShallowArrayStub::Mode mode = | 5330 FastCloneShallowArrayStub::Mode mode = |
| 5326 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; | 5331 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
| 5327 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length); | 5332 FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE, length); |
| 5328 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5333 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5329 } else if (instr->hydrogen()->depth() > 1) { | 5334 } else if (instr->hydrogen()->depth() > 1) { |
| 5330 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); | 5335 CallRuntime(Runtime::kCreateArrayLiteral, 4, instr); |
| 5331 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 5336 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 5332 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); | 5337 CallRuntime(Runtime::kCreateArrayLiteralShallow, 4, instr); |
| 5333 } else { | 5338 } else { |
| 5334 FastCloneShallowArrayStub::Mode mode = | 5339 FastCloneShallowArrayStub::Mode mode = |
| 5335 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS | 5340 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS |
| 5336 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 5341 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| 5337 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | 5342 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 5338 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 5343 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 5339 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5344 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5340 } | 5345 } |
| 5341 } | 5346 } |
| 5342 | 5347 |
| 5343 | 5348 |
| 5344 void LCodeGen::EmitDeepCopy(Handle<JSObject> object, | 5349 void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| 5350 Handle<JSObject> original_object, |
| 5345 Register result, | 5351 Register result, |
| 5346 Register source, | 5352 Register source, |
| 5347 int* offset, | 5353 int* offset, |
| 5348 AllocationSiteMode mode) { | 5354 AllocationSiteMode mode) { |
| 5349 ASSERT(!source.is(ecx)); | 5355 ASSERT(!source.is(ecx)); |
| 5350 ASSERT(!result.is(ecx)); | 5356 ASSERT(!result.is(ecx)); |
| 5351 | 5357 |
| 5358 // Should we track allocation info for *this* object in the tree? |
| 5352 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && | 5359 bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && |
| 5353 object->map()->CanTrackAllocationSite(); | 5360 object->map()->CanTrackAllocationSite(); |
| 5354 | 5361 |
| 5362 if (create_allocation_site_info && object->IsJSArray()) { |
| 5363 create_allocation_site_info = AllocationSiteInfo::GetMode( |
| 5364 object->GetElementsKind()) == TRACK_ALLOCATION_SITE; |
| 5365 } |
| 5366 |
| 5355 if (FLAG_debug_code) { | 5367 if (FLAG_debug_code) { |
| 5356 __ LoadHeapObject(ecx, object); | 5368 __ LoadHeapObject(ecx, object); |
| 5357 __ cmp(source, ecx); | 5369 __ cmp(source, ecx); |
| 5358 __ Assert(equal, "Unexpected object literal boilerplate"); | 5370 __ Assert(equal, "Unexpected object literal boilerplate"); |
| 5359 __ mov(ecx, FieldOperand(source, HeapObject::kMapOffset)); | 5371 __ mov(ecx, FieldOperand(source, HeapObject::kMapOffset)); |
| 5360 __ cmp(ecx, Handle<Map>(object->map())); | 5372 __ cmp(ecx, Handle<Map>(object->map())); |
| 5361 __ Assert(equal, "Unexpected boilerplate map"); | 5373 __ Assert(equal, "Unexpected boilerplate map"); |
| 5362 __ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset)); | 5374 __ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset)); |
| 5363 __ and_(ecx, Map::kElementsKindMask); | 5375 __ and_(ecx, Map::kElementsKindMask); |
| 5364 __ cmp(ecx, object->GetElementsKind() << Map::kElementsKindShift); | 5376 __ cmp(ecx, object->GetElementsKind() << Map::kElementsKindShift); |
| 5365 __ Assert(equal, "Unexpected boilerplate elements kind"); | 5377 __ Assert(equal, "Unexpected boilerplate elements kind"); |
| 5366 } | 5378 } |
| 5367 | 5379 |
| 5368 // Only elements backing stores for non-COW arrays need to be copied. | 5380 // Only elements backing stores for non-COW arrays need to be copied. |
| 5369 Handle<FixedArrayBase> elements(object->elements()); | 5381 Handle<FixedArrayBase> elements(object->elements()); |
| 5382 Handle<FixedArrayBase> original_elements(original_object->elements()); |
| 5370 bool has_elements = elements->length() > 0 && | 5383 bool has_elements = elements->length() > 0 && |
| 5371 elements->map() != isolate()->heap()->fixed_cow_array_map(); | 5384 elements->map() != isolate()->heap()->fixed_cow_array_map(); |
| 5372 | 5385 |
| 5373 // Increase the offset so that subsequent objects end up right after | 5386 // Increase the offset so that subsequent objects end up right after |
| 5374 // this object and its backing store. | 5387 // this object and its backing store. |
| 5375 int object_offset = *offset; | 5388 int object_offset = *offset; |
| 5376 int object_size = object->map()->instance_size(); | 5389 int object_size = object->map()->instance_size(); |
| 5377 int elements_size = has_elements ? elements->Size() : 0; | 5390 int elements_size = has_elements ? elements->Size() : 0; |
| 5378 int elements_offset = *offset + object_size; | 5391 int elements_offset = *offset + object_size; |
| 5379 if (create_allocation_site_info) { | 5392 if (create_allocation_site_info) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5395 } | 5408 } |
| 5396 __ mov(FieldOperand(result, object_offset + i), ecx); | 5409 __ mov(FieldOperand(result, object_offset + i), ecx); |
| 5397 } | 5410 } |
| 5398 | 5411 |
| 5399 // Copy in-object properties. | 5412 // Copy in-object properties. |
| 5400 for (int i = 0; i < inobject_properties; i++) { | 5413 for (int i = 0; i < inobject_properties; i++) { |
| 5401 int total_offset = object_offset + object->GetInObjectPropertyOffset(i); | 5414 int total_offset = object_offset + object->GetInObjectPropertyOffset(i); |
| 5402 Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i)); | 5415 Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i)); |
| 5403 if (value->IsJSObject()) { | 5416 if (value->IsJSObject()) { |
| 5404 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 5417 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
| 5418 Handle<JSObject> original_value_object = Handle<JSObject>::cast( |
| 5419 Handle<Object>(original_object->InObjectPropertyAt(i))); |
| 5420 |
| 5405 __ lea(ecx, Operand(result, *offset)); | 5421 __ lea(ecx, Operand(result, *offset)); |
| 5406 __ mov(FieldOperand(result, total_offset), ecx); | 5422 __ mov(FieldOperand(result, total_offset), ecx); |
| 5407 __ LoadHeapObject(source, value_object); | 5423 __ LoadHeapObject(source, value_object); |
| 5408 EmitDeepCopy(value_object, result, source, offset, | 5424 EmitDeepCopy(value_object, original_value_object, result, source, |
| 5409 DONT_TRACK_ALLOCATION_SITE); | 5425 offset, mode); |
| 5410 } else if (value->IsHeapObject()) { | 5426 } else if (value->IsHeapObject()) { |
| 5411 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); | 5427 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); |
| 5412 __ mov(FieldOperand(result, total_offset), ecx); | 5428 __ mov(FieldOperand(result, total_offset), ecx); |
| 5413 } else { | 5429 } else { |
| 5414 __ mov(FieldOperand(result, total_offset), Immediate(value)); | 5430 __ mov(FieldOperand(result, total_offset), Immediate(value)); |
| 5415 } | 5431 } |
| 5416 } | 5432 } |
| 5417 | 5433 |
| 5418 // Build Allocation Site Info if desired | 5434 // Build Allocation Site Info if desired |
| 5419 if (create_allocation_site_info) { | 5435 if (create_allocation_site_info) { |
| 5420 __ mov(FieldOperand(result, object_size), | 5436 __ mov(FieldOperand(result, object_size + object_offset), |
| 5421 Immediate(Handle<Map>(isolate()->heap()-> | 5437 Immediate(Handle<Map>(isolate()->heap()-> |
| 5422 allocation_site_info_map()))); | 5438 allocation_site_info_map()))); |
| 5423 __ mov(FieldOperand(result, object_size + kPointerSize), source); | 5439 __ LoadHeapObject(ecx, original_object); |
| 5440 __ mov(FieldOperand(result, object_size + object_offset + kPointerSize), |
| 5441 ecx); |
| 5424 } | 5442 } |
| 5425 | 5443 |
| 5426 if (has_elements) { | 5444 if (has_elements) { |
| 5427 // Copy elements backing store header. | 5445 // Copy elements backing store header. |
| 5428 __ LoadHeapObject(source, elements); | 5446 __ LoadHeapObject(source, elements); |
| 5429 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { | 5447 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { |
| 5430 __ mov(ecx, FieldOperand(source, i)); | 5448 __ mov(ecx, FieldOperand(source, i)); |
| 5431 __ mov(FieldOperand(result, elements_offset + i), ecx); | 5449 __ mov(FieldOperand(result, elements_offset + i), ecx); |
| 5432 } | 5450 } |
| 5433 | 5451 |
| 5434 // Copy elements backing store content. | 5452 // Copy elements backing store content. |
| 5435 int elements_length = elements->length(); | 5453 int elements_length = elements->length(); |
| 5436 if (elements->IsFixedDoubleArray()) { | 5454 if (elements->IsFixedDoubleArray()) { |
| 5437 Handle<FixedDoubleArray> double_array = | 5455 Handle<FixedDoubleArray> double_array = |
| 5438 Handle<FixedDoubleArray>::cast(elements); | 5456 Handle<FixedDoubleArray>::cast(elements); |
| 5439 for (int i = 0; i < elements_length; i++) { | 5457 for (int i = 0; i < elements_length; i++) { |
| 5440 int64_t value = double_array->get_representation(i); | 5458 int64_t value = double_array->get_representation(i); |
| 5441 int32_t value_low = static_cast<int32_t>(value & 0xFFFFFFFF); | 5459 int32_t value_low = static_cast<int32_t>(value & 0xFFFFFFFF); |
| 5442 int32_t value_high = static_cast<int32_t>(value >> 32); | 5460 int32_t value_high = static_cast<int32_t>(value >> 32); |
| 5443 int total_offset = | 5461 int total_offset = |
| 5444 elements_offset + FixedDoubleArray::OffsetOfElementAt(i); | 5462 elements_offset + FixedDoubleArray::OffsetOfElementAt(i); |
| 5445 __ mov(FieldOperand(result, total_offset), Immediate(value_low)); | 5463 __ mov(FieldOperand(result, total_offset), Immediate(value_low)); |
| 5446 __ mov(FieldOperand(result, total_offset + 4), Immediate(value_high)); | 5464 __ mov(FieldOperand(result, total_offset + 4), Immediate(value_high)); |
| 5447 } | 5465 } |
| 5448 } else if (elements->IsFixedArray()) { | 5466 } else if (elements->IsFixedArray()) { |
| 5449 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); | 5467 Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); |
| 5468 Handle<FixedArray> original_fast_elements = |
| 5469 Handle<FixedArray>::cast(original_elements); |
| 5450 for (int i = 0; i < elements_length; i++) { | 5470 for (int i = 0; i < elements_length; i++) { |
| 5451 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); | 5471 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); |
| 5452 Handle<Object> value(fast_elements->get(i)); | 5472 Handle<Object> value(fast_elements->get(i)); |
| 5453 if (value->IsJSObject()) { | 5473 if (value->IsJSObject()) { |
| 5454 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 5474 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
| 5475 Handle<JSObject> original_value_object = Handle<JSObject>::cast( |
| 5476 Handle<Object>(original_fast_elements->get(i))); |
| 5455 __ lea(ecx, Operand(result, *offset)); | 5477 __ lea(ecx, Operand(result, *offset)); |
| 5456 __ mov(FieldOperand(result, total_offset), ecx); | 5478 __ mov(FieldOperand(result, total_offset), ecx); |
| 5457 __ LoadHeapObject(source, value_object); | 5479 __ LoadHeapObject(source, value_object); |
| 5458 EmitDeepCopy(value_object, result, source, offset, | 5480 |
| 5459 DONT_TRACK_ALLOCATION_SITE); | 5481 // TODO(mvstanton): do we have to worry that the original object |
| 5482 // changed from a fixed array to a fixeddoublearray? If that happened |
| 5483 // then the original_value_object expression might point to garbage |
| 5484 // memory, right? |
| 5485 ASSERT(!value_object.is_identical_to(original_value_object)); |
| 5486 EmitDeepCopy(value_object, original_value_object, result, source, |
| 5487 offset, mode); |
| 5460 } else if (value->IsHeapObject()) { | 5488 } else if (value->IsHeapObject()) { |
| 5461 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); | 5489 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); |
| 5462 __ mov(FieldOperand(result, total_offset), ecx); | 5490 __ mov(FieldOperand(result, total_offset), ecx); |
| 5463 } else { | 5491 } else { |
| 5464 __ mov(FieldOperand(result, total_offset), Immediate(value)); | 5492 __ mov(FieldOperand(result, total_offset), Immediate(value)); |
| 5465 } | 5493 } |
| 5466 } | 5494 } |
| 5467 } else { | 5495 } else { |
| 5468 UNREACHABLE(); | 5496 UNREACHABLE(); |
| 5469 } | 5497 } |
| 5470 } | 5498 } |
| 5471 } | 5499 } |
| 5472 | 5500 |
| 5473 | 5501 |
| 5474 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { | 5502 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { |
| 5475 ASSERT(ToRegister(instr->context()).is(esi)); | 5503 ASSERT(ToRegister(instr->context()).is(esi)); |
| 5476 int size = instr->hydrogen()->total_size(); | 5504 int size = instr->hydrogen()->total_size(); |
| 5477 ElementsKind boilerplate_elements_kind = | |
| 5478 instr->hydrogen()->boilerplate()->GetElementsKind(); | |
| 5479 | |
| 5480 // Deopt if the literal boilerplate ElementsKind is of a type different than | |
| 5481 // the expected one. The check isn't necessary if the boilerplate has already | |
| 5482 // already been converted to TERMINAL_FAST_ELEMENTS_KIND. | |
| 5483 if (CanTransitionToMoreGeneralFastElementsKind( | |
| 5484 boilerplate_elements_kind, true)) { | |
| 5485 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate()); | |
| 5486 __ mov(ecx, FieldOperand(ebx, HeapObject::kMapOffset)); | |
| 5487 // Load the map's "bit field 2". We only need the first byte, | |
| 5488 // but the following masking takes care of that anyway. | |
| 5489 __ mov(ecx, FieldOperand(ecx, Map::kBitField2Offset)); | |
| 5490 // Retrieve elements_kind from bit field 2. | |
| 5491 __ and_(ecx, Map::kElementsKindMask); | |
| 5492 __ cmp(ecx, boilerplate_elements_kind << Map::kElementsKindShift); | |
| 5493 DeoptimizeIf(not_equal, instr->environment()); | |
| 5494 } | |
| 5495 | 5505 |
| 5496 // Allocate all objects that are part of the literal in one big | 5506 // Allocate all objects that are part of the literal in one big |
| 5497 // allocation. This avoids multiple limit checks. | 5507 // allocation. This avoids multiple limit checks. |
| 5498 Label allocated, runtime_allocate; | 5508 Label allocated, runtime_allocate; |
| 5499 __ AllocateInNewSpace(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); | 5509 __ AllocateInNewSpace(size, eax, ecx, edx, &runtime_allocate, TAG_OBJECT); |
| 5500 __ jmp(&allocated); | 5510 __ jmp(&allocated); |
| 5501 | 5511 |
| 5502 __ bind(&runtime_allocate); | 5512 __ bind(&runtime_allocate); |
| 5503 __ push(Immediate(Smi::FromInt(size))); | 5513 __ push(Immediate(Smi::FromInt(size))); |
| 5504 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); | 5514 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
| 5505 | 5515 |
| 5506 __ bind(&allocated); | 5516 __ bind(&allocated); |
| 5507 int offset = 0; | 5517 int offset = 0; |
| 5508 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate()); | 5518 __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate()); |
| 5509 EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset, | 5519 EmitDeepCopy(instr->hydrogen()->boilerplate(), |
| 5520 instr->hydrogen()->original_boilerplate(), |
| 5521 eax, ebx, &offset, |
| 5510 instr->hydrogen()->allocation_site_mode()); | 5522 instr->hydrogen()->allocation_site_mode()); |
| 5511 ASSERT_EQ(size, offset); | 5523 ASSERT_EQ(size, offset); |
| 5512 } | 5524 } |
| 5513 | 5525 |
| 5514 | 5526 |
| 5515 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 5527 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
| 5516 ASSERT(ToRegister(instr->context()).is(esi)); | 5528 ASSERT(ToRegister(instr->context()).is(esi)); |
| 5517 Handle<FixedArray> literals(instr->environment()->closure()->literals()); | 5529 Handle<FixedArray> literals(instr->environment()->closure()->literals()); |
| 5518 Handle<FixedArray> constant_properties = | 5530 Handle<FixedArray> constant_properties = |
| 5519 instr->hydrogen()->constant_properties(); | 5531 instr->hydrogen()->constant_properties(); |
| 5520 | 5532 |
| 5521 // Set up the parameters to the stub/runtime call. | 5533 // Set up the parameters to the stub/runtime call. |
| 5522 __ PushHeapObject(literals); | 5534 __ PushHeapObject(literals); |
| 5523 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | 5535 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); |
| 5524 __ push(Immediate(constant_properties)); | 5536 __ push(Immediate(constant_properties)); |
| 5525 int flags = instr->hydrogen()->fast_elements() | 5537 int flags = instr->hydrogen()->fast_elements() |
| 5526 ? ObjectLiteral::kFastElements | 5538 ? ObjectLiteral::kFastElements |
| 5527 : ObjectLiteral::kNoFlags; | 5539 : ObjectLiteral::kNoFlags; |
| 5528 flags |= instr->hydrogen()->has_function() | 5540 flags |= instr->hydrogen()->has_function() |
| 5529 ? ObjectLiteral::kHasFunction | 5541 ? ObjectLiteral::kHasFunction |
| 5530 : ObjectLiteral::kNoFlags; | 5542 : ObjectLiteral::kNoFlags; |
| 5543 |
| 5544 if (instr->hydrogen()->allocation_site_mode() == TRACK_ALLOCATION_SITE) { |
| 5545 flags |= ObjectLiteral::kAllocationSiteInfoAllowed; |
| 5546 } |
| 5547 |
| 5531 __ push(Immediate(Smi::FromInt(flags))); | 5548 __ push(Immediate(Smi::FromInt(flags))); |
| 5532 | 5549 |
| 5533 // Pick the right runtime function or stub to call. | 5550 // Pick the right runtime function or stub to call. |
| 5534 int properties_count = constant_properties->length() / 2; | 5551 int properties_count = constant_properties->length() / 2; |
| 5535 if (instr->hydrogen()->depth() > 1) { | 5552 if (instr->hydrogen()->depth() > 1) { |
| 5536 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | 5553 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
| 5537 } else if (flags != ObjectLiteral::kFastElements || | 5554 } else if (flags != ObjectLiteral::kFastElements || |
| 5538 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 5555 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 5539 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | 5556 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); |
| 5540 } else { | 5557 } else { |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5974 FixedArray::kHeaderSize - kPointerSize)); | 5991 FixedArray::kHeaderSize - kPointerSize)); |
| 5975 __ bind(&done); | 5992 __ bind(&done); |
| 5976 } | 5993 } |
| 5977 | 5994 |
| 5978 | 5995 |
| 5979 #undef __ | 5996 #undef __ |
| 5980 | 5997 |
| 5981 } } // namespace v8::internal | 5998 } } // namespace v8::internal |
| 5982 | 5999 |
| 5983 #endif // V8_TARGET_ARCH_IA32 | 6000 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |