| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 if (info()->saves_caller_doubles() && CpuFeatures::IsSupported(SSE2)) { | 285 if (info()->saves_caller_doubles() && CpuFeatures::IsSupported(SSE2)) { |
| 286 SaveCallerDoubles(); | 286 SaveCallerDoubles(); |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 | 289 |
| 290 // Possibly allocate a local context. | 290 // Possibly allocate a local context. |
| 291 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 291 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 292 if (heap_slots > 0) { | 292 if (heap_slots > 0) { |
| 293 Comment(";;; Allocate local context"); | 293 Comment(";;; Allocate local context"); |
| 294 // Argument to NewContext is the function, which is still in edi. | 294 // Argument to NewContext is the function, which is still in edi. |
| 295 __ push(edi); | |
| 296 if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 295 if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
| 297 FastNewContextStub stub(heap_slots); | 296 FastNewContextStub stub(heap_slots); |
| 298 __ CallStub(&stub); | 297 __ CallStub(&stub); |
| 299 } else { | 298 } else { |
| 299 __ push(edi); |
| 300 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 300 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| 301 } | 301 } |
| 302 RecordSafepoint(Safepoint::kNoLazyDeopt); | 302 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 303 // Context is returned in both eax and esi. It replaces the context | 303 // Context is returned in eax. It replaces the context passed to us. |
| 304 // passed to us. It's saved in the stack and kept live in esi. | 304 // It's saved in the stack and kept live in esi. |
| 305 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); | 305 __ mov(esi, eax); |
| 306 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); |
| 306 | 307 |
| 307 // Copy parameters into context if necessary. | 308 // Copy parameters into context if necessary. |
| 308 int num_parameters = scope()->num_parameters(); | 309 int num_parameters = scope()->num_parameters(); |
| 309 for (int i = 0; i < num_parameters; i++) { | 310 for (int i = 0; i < num_parameters; i++) { |
| 310 Variable* var = scope()->parameter(i); | 311 Variable* var = scope()->parameter(i); |
| 311 if (var->IsContextSlot()) { | 312 if (var->IsContextSlot()) { |
| 312 int parameter_offset = StandardFrameConstants::kCallerSPOffset + | 313 int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
| 313 (num_parameters - 1 - i) * kPointerSize; | 314 (num_parameters - 1 - i) * kPointerSize; |
| 314 // Load parameter from stack. | 315 // Load parameter from stack. |
| 315 __ mov(eax, Operand(ebp, parameter_offset)); | 316 __ mov(eax, Operand(ebp, parameter_offset)); |
| (...skipping 2873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3189 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); | 3190 __ cmp(Operand::ForCell(cell_handle), factory()->the_hole_value()); |
| 3190 DeoptimizeIf(equal, instr->environment()); | 3191 DeoptimizeIf(equal, instr->environment()); |
| 3191 } | 3192 } |
| 3192 | 3193 |
| 3193 // Store the value. | 3194 // Store the value. |
| 3194 __ mov(Operand::ForCell(cell_handle), value); | 3195 __ mov(Operand::ForCell(cell_handle), value); |
| 3195 // Cells are always rescanned, so no write barrier here. | 3196 // Cells are always rescanned, so no write barrier here. |
| 3196 } | 3197 } |
| 3197 | 3198 |
| 3198 | 3199 |
| 3199 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | |
| 3200 ASSERT(ToRegister(instr->context()).is(esi)); | |
| 3201 ASSERT(ToRegister(instr->global_object()).is(edx)); | |
| 3202 ASSERT(ToRegister(instr->value()).is(eax)); | |
| 3203 | |
| 3204 __ mov(ecx, instr->name()); | |
| 3205 Handle<Code> ic = StoreIC::initialize_stub(isolate(), | |
| 3206 instr->strict_mode_flag(), | |
| 3207 CONTEXTUAL); | |
| 3208 CallCode(ic, RelocInfo::CODE_TARGET, instr); | |
| 3209 } | |
| 3210 | |
| 3211 | |
| 3212 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3200 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 3213 Register context = ToRegister(instr->context()); | 3201 Register context = ToRegister(instr->context()); |
| 3214 Register result = ToRegister(instr->result()); | 3202 Register result = ToRegister(instr->result()); |
| 3215 __ mov(result, ContextOperand(context, instr->slot_index())); | 3203 __ mov(result, ContextOperand(context, instr->slot_index())); |
| 3216 | 3204 |
| 3217 if (instr->hydrogen()->RequiresHoleCheck()) { | 3205 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 3218 __ cmp(result, factory()->the_hole_value()); | 3206 __ cmp(result, factory()->the_hole_value()); |
| 3219 if (instr->hydrogen()->DeoptimizesOnHole()) { | 3207 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 3220 DeoptimizeIf(equal, instr->environment()); | 3208 DeoptimizeIf(equal, instr->environment()); |
| 3221 } else { | 3209 } else { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3414 elements_kind)) { | 3402 elements_kind)) { |
| 3415 __ SmiUntag(ToRegister(key)); | 3403 __ SmiUntag(ToRegister(key)); |
| 3416 } | 3404 } |
| 3417 Operand operand(BuildFastArrayOperand( | 3405 Operand operand(BuildFastArrayOperand( |
| 3418 instr->elements(), | 3406 instr->elements(), |
| 3419 key, | 3407 key, |
| 3420 instr->hydrogen()->key()->representation(), | 3408 instr->hydrogen()->key()->representation(), |
| 3421 elements_kind, | 3409 elements_kind, |
| 3422 0, | 3410 0, |
| 3423 instr->additional_index())); | 3411 instr->additional_index())); |
| 3424 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 3412 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 3413 elements_kind == FLOAT32_ELEMENTS) { |
| 3425 if (CpuFeatures::IsSupported(SSE2)) { | 3414 if (CpuFeatures::IsSupported(SSE2)) { |
| 3426 CpuFeatureScope scope(masm(), SSE2); | 3415 CpuFeatureScope scope(masm(), SSE2); |
| 3427 XMMRegister result(ToDoubleRegister(instr->result())); | 3416 XMMRegister result(ToDoubleRegister(instr->result())); |
| 3428 __ movss(result, operand); | 3417 __ movss(result, operand); |
| 3429 __ cvtss2sd(result, result); | 3418 __ cvtss2sd(result, result); |
| 3430 } else { | 3419 } else { |
| 3431 X87Mov(ToX87Register(instr->result()), operand, kX87FloatOperand); | 3420 X87Mov(ToX87Register(instr->result()), operand, kX87FloatOperand); |
| 3432 } | 3421 } |
| 3433 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 3422 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS || |
| 3423 elements_kind == FLOAT64_ELEMENTS) { |
| 3434 if (CpuFeatures::IsSupported(SSE2)) { | 3424 if (CpuFeatures::IsSupported(SSE2)) { |
| 3435 CpuFeatureScope scope(masm(), SSE2); | 3425 CpuFeatureScope scope(masm(), SSE2); |
| 3436 __ movsd(ToDoubleRegister(instr->result()), operand); | 3426 __ movsd(ToDoubleRegister(instr->result()), operand); |
| 3437 } else { | 3427 } else { |
| 3438 X87Mov(ToX87Register(instr->result()), operand); | 3428 X87Mov(ToX87Register(instr->result()), operand); |
| 3439 } | 3429 } |
| 3440 } else { | 3430 } else { |
| 3441 Register result(ToRegister(instr->result())); | 3431 Register result(ToRegister(instr->result())); |
| 3442 switch (elements_kind) { | 3432 switch (elements_kind) { |
| 3443 case EXTERNAL_BYTE_ELEMENTS: | 3433 case EXTERNAL_BYTE_ELEMENTS: |
| 3434 case INT8_ELEMENTS: |
| 3444 __ movsx_b(result, operand); | 3435 __ movsx_b(result, operand); |
| 3445 break; | 3436 break; |
| 3446 case EXTERNAL_PIXEL_ELEMENTS: | 3437 case EXTERNAL_PIXEL_ELEMENTS: |
| 3447 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3438 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 3439 case UINT8_ELEMENTS: |
| 3440 case UINT8_CLAMPED_ELEMENTS: |
| 3448 __ movzx_b(result, operand); | 3441 __ movzx_b(result, operand); |
| 3449 break; | 3442 break; |
| 3450 case EXTERNAL_SHORT_ELEMENTS: | 3443 case EXTERNAL_SHORT_ELEMENTS: |
| 3444 case INT16_ELEMENTS: |
| 3451 __ movsx_w(result, operand); | 3445 __ movsx_w(result, operand); |
| 3452 break; | 3446 break; |
| 3453 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3447 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 3448 case UINT16_ELEMENTS: |
| 3454 __ movzx_w(result, operand); | 3449 __ movzx_w(result, operand); |
| 3455 break; | 3450 break; |
| 3456 case EXTERNAL_INT_ELEMENTS: | 3451 case EXTERNAL_INT_ELEMENTS: |
| 3452 case INT32_ELEMENTS: |
| 3457 __ mov(result, operand); | 3453 __ mov(result, operand); |
| 3458 break; | 3454 break; |
| 3459 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3455 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 3456 case UINT32_ELEMENTS: |
| 3460 __ mov(result, operand); | 3457 __ mov(result, operand); |
| 3461 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { | 3458 if (!instr->hydrogen()->CheckFlag(HInstruction::kUint32)) { |
| 3462 __ test(result, Operand(result)); | 3459 __ test(result, Operand(result)); |
| 3463 DeoptimizeIf(negative, instr->environment()); | 3460 DeoptimizeIf(negative, instr->environment()); |
| 3464 } | 3461 } |
| 3465 break; | 3462 break; |
| 3466 case EXTERNAL_FLOAT_ELEMENTS: | 3463 case EXTERNAL_FLOAT_ELEMENTS: |
| 3467 case EXTERNAL_DOUBLE_ELEMENTS: | 3464 case EXTERNAL_DOUBLE_ELEMENTS: |
| 3465 case FLOAT32_ELEMENTS: |
| 3466 case FLOAT64_ELEMENTS: |
| 3468 case FAST_SMI_ELEMENTS: | 3467 case FAST_SMI_ELEMENTS: |
| 3469 case FAST_ELEMENTS: | 3468 case FAST_ELEMENTS: |
| 3470 case FAST_DOUBLE_ELEMENTS: | 3469 case FAST_DOUBLE_ELEMENTS: |
| 3471 case FAST_HOLEY_SMI_ELEMENTS: | 3470 case FAST_HOLEY_SMI_ELEMENTS: |
| 3472 case FAST_HOLEY_ELEMENTS: | 3471 case FAST_HOLEY_ELEMENTS: |
| 3473 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3472 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 3474 case DICTIONARY_ELEMENTS: | 3473 case DICTIONARY_ELEMENTS: |
| 3475 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3474 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 3476 UNREACHABLE(); | 3475 UNREACHABLE(); |
| 3477 break; | 3476 break; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3530 DeoptimizeIf(not_equal, instr->environment()); | 3529 DeoptimizeIf(not_equal, instr->environment()); |
| 3531 } else { | 3530 } else { |
| 3532 __ cmp(result, factory()->the_hole_value()); | 3531 __ cmp(result, factory()->the_hole_value()); |
| 3533 DeoptimizeIf(equal, instr->environment()); | 3532 DeoptimizeIf(equal, instr->environment()); |
| 3534 } | 3533 } |
| 3535 } | 3534 } |
| 3536 } | 3535 } |
| 3537 | 3536 |
| 3538 | 3537 |
| 3539 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { | 3538 void LCodeGen::DoLoadKeyed(LLoadKeyed* instr) { |
| 3540 if (instr->is_external()) { | 3539 if (instr->is_typed_elements()) { |
| 3541 DoLoadKeyedExternalArray(instr); | 3540 DoLoadKeyedExternalArray(instr); |
| 3542 } else if (instr->hydrogen()->representation().IsDouble()) { | 3541 } else if (instr->hydrogen()->representation().IsDouble()) { |
| 3543 DoLoadKeyedFixedDoubleArray(instr); | 3542 DoLoadKeyedFixedDoubleArray(instr); |
| 3544 } else { | 3543 } else { |
| 3545 DoLoadKeyedFixedArray(instr); | 3544 DoLoadKeyedFixedArray(instr); |
| 3546 } | 3545 } |
| 3547 } | 3546 } |
| 3548 | 3547 |
| 3549 | 3548 |
| 3550 Operand LCodeGen::BuildFastArrayOperand( | 3549 Operand LCodeGen::BuildFastArrayOperand( |
| 3551 LOperand* elements_pointer, | 3550 LOperand* elements_pointer, |
| 3552 LOperand* key, | 3551 LOperand* key, |
| 3553 Representation key_representation, | 3552 Representation key_representation, |
| 3554 ElementsKind elements_kind, | 3553 ElementsKind elements_kind, |
| 3555 uint32_t offset, | 3554 uint32_t offset, |
| 3556 uint32_t additional_index) { | 3555 uint32_t additional_index) { |
| 3557 Register elements_pointer_reg = ToRegister(elements_pointer); | 3556 Register elements_pointer_reg = ToRegister(elements_pointer); |
| 3558 int element_shift_size = ElementsKindToShiftSize(elements_kind); | 3557 int element_shift_size = ElementsKindToShiftSize(elements_kind); |
| 3558 if (IsFixedTypedArrayElementsKind(elements_kind)) { |
| 3559 offset += FixedTypedArrayBase::kDataOffset - kHeapObjectTag; |
| 3560 } |
| 3559 int shift_size = element_shift_size; | 3561 int shift_size = element_shift_size; |
| 3560 if (key->IsConstantOperand()) { | 3562 if (key->IsConstantOperand()) { |
| 3561 int constant_value = ToInteger32(LConstantOperand::cast(key)); | 3563 int constant_value = ToInteger32(LConstantOperand::cast(key)); |
| 3562 if (constant_value & 0xF0000000) { | 3564 if (constant_value & 0xF0000000) { |
| 3563 Abort(kArrayIndexConstantValueTooBig); | 3565 Abort(kArrayIndexConstantValueTooBig); |
| 3564 } | 3566 } |
| 3565 return Operand(elements_pointer_reg, | 3567 return Operand(elements_pointer_reg, |
| 3566 ((constant_value + additional_index) << shift_size) | 3568 ((constant_value + additional_index) << shift_size) |
| 3567 + offset); | 3569 + offset); |
| 3568 } else { | 3570 } else { |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4282 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4284 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4283 } | 4285 } |
| 4284 | 4286 |
| 4285 | 4287 |
| 4286 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { | 4288 void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
| 4287 ASSERT(ToRegister(instr->context()).is(esi)); | 4289 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4288 ASSERT(ToRegister(instr->constructor()).is(edi)); | 4290 ASSERT(ToRegister(instr->constructor()).is(edi)); |
| 4289 ASSERT(ToRegister(instr->result()).is(eax)); | 4291 ASSERT(ToRegister(instr->result()).is(eax)); |
| 4290 | 4292 |
| 4291 __ Set(eax, Immediate(instr->arity())); | 4293 __ Set(eax, Immediate(instr->arity())); |
| 4292 __ mov(ebx, instr->hydrogen()->property_cell()); | 4294 __ mov(ebx, factory()->undefined_value()); |
| 4293 ElementsKind kind = instr->hydrogen()->elements_kind(); | 4295 ElementsKind kind = instr->hydrogen()->elements_kind(); |
| 4294 AllocationSiteOverrideMode override_mode = | 4296 AllocationSiteOverrideMode override_mode = |
| 4295 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) | 4297 (AllocationSite::GetMode(kind) == TRACK_ALLOCATION_SITE) |
| 4296 ? DISABLE_ALLOCATION_SITES | 4298 ? DISABLE_ALLOCATION_SITES |
| 4297 : DONT_OVERRIDE; | 4299 : DONT_OVERRIDE; |
| 4298 | 4300 |
| 4299 if (instr->arity() == 0) { | 4301 if (instr->arity() == 0) { |
| 4300 ArrayNoArgumentConstructorStub stub(kind, override_mode); | 4302 ArrayNoArgumentConstructorStub stub(kind, override_mode); |
| 4301 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); | 4303 CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
| 4302 } else if (instr->arity() == 1) { | 4304 } else if (instr->arity() == 1) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4478 } | 4480 } |
| 4479 | 4481 |
| 4480 | 4482 |
| 4481 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4483 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| 4482 ASSERT(ToRegister(instr->context()).is(esi)); | 4484 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4483 ASSERT(ToRegister(instr->object()).is(edx)); | 4485 ASSERT(ToRegister(instr->object()).is(edx)); |
| 4484 ASSERT(ToRegister(instr->value()).is(eax)); | 4486 ASSERT(ToRegister(instr->value()).is(eax)); |
| 4485 | 4487 |
| 4486 __ mov(ecx, instr->name()); | 4488 __ mov(ecx, instr->name()); |
| 4487 Handle<Code> ic = StoreIC::initialize_stub(isolate(), | 4489 Handle<Code> ic = StoreIC::initialize_stub(isolate(), |
| 4488 instr->strict_mode_flag(), | 4490 instr->strict_mode_flag()); |
| 4489 NOT_CONTEXTUAL); | |
| 4490 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4491 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4491 } | 4492 } |
| 4492 | 4493 |
| 4493 | 4494 |
| 4494 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { | 4495 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { |
| 4495 if (FLAG_debug_code && check->hydrogen()->skip_check()) { | 4496 if (FLAG_debug_code && check->hydrogen()->skip_check()) { |
| 4496 Label done; | 4497 Label done; |
| 4497 __ j(NegateCondition(cc), &done, Label::kNear); | 4498 __ j(NegateCondition(cc), &done, Label::kNear); |
| 4498 __ int3(); | 4499 __ int3(); |
| 4499 __ bind(&done); | 4500 __ bind(&done); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4531 elements_kind)) { | 4532 elements_kind)) { |
| 4532 __ SmiUntag(ToRegister(key)); | 4533 __ SmiUntag(ToRegister(key)); |
| 4533 } | 4534 } |
| 4534 Operand operand(BuildFastArrayOperand( | 4535 Operand operand(BuildFastArrayOperand( |
| 4535 instr->elements(), | 4536 instr->elements(), |
| 4536 key, | 4537 key, |
| 4537 instr->hydrogen()->key()->representation(), | 4538 instr->hydrogen()->key()->representation(), |
| 4538 elements_kind, | 4539 elements_kind, |
| 4539 0, | 4540 0, |
| 4540 instr->additional_index())); | 4541 instr->additional_index())); |
| 4541 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) { | 4542 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || |
| 4543 elements_kind == FLOAT32_ELEMENTS) { |
| 4542 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 4544 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
| 4543 CpuFeatureScope scope(masm(), SSE2); | 4545 CpuFeatureScope scope(masm(), SSE2); |
| 4544 XMMRegister xmm_scratch = double_scratch0(); | 4546 XMMRegister xmm_scratch = double_scratch0(); |
| 4545 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value())); | 4547 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value())); |
| 4546 __ movss(operand, xmm_scratch); | 4548 __ movss(operand, xmm_scratch); |
| 4547 } else { | 4549 } else { |
| 4548 __ fld(0); | 4550 __ fld(0); |
| 4549 __ fstp_s(operand); | 4551 __ fstp_s(operand); |
| 4550 } | 4552 } |
| 4551 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | 4553 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS || |
| 4554 elements_kind == FLOAT64_ELEMENTS) { |
| 4552 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 4555 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
| 4553 CpuFeatureScope scope(masm(), SSE2); | 4556 CpuFeatureScope scope(masm(), SSE2); |
| 4554 __ movsd(operand, ToDoubleRegister(instr->value())); | 4557 __ movsd(operand, ToDoubleRegister(instr->value())); |
| 4555 } else { | 4558 } else { |
| 4556 X87Mov(operand, ToX87Register(instr->value())); | 4559 X87Mov(operand, ToX87Register(instr->value())); |
| 4557 } | 4560 } |
| 4558 } else { | 4561 } else { |
| 4559 Register value = ToRegister(instr->value()); | 4562 Register value = ToRegister(instr->value()); |
| 4560 switch (elements_kind) { | 4563 switch (elements_kind) { |
| 4561 case EXTERNAL_PIXEL_ELEMENTS: | 4564 case EXTERNAL_PIXEL_ELEMENTS: |
| 4562 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 4565 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 4563 case EXTERNAL_BYTE_ELEMENTS: | 4566 case EXTERNAL_BYTE_ELEMENTS: |
| 4567 case UINT8_ELEMENTS: |
| 4568 case INT8_ELEMENTS: |
| 4569 case UINT8_CLAMPED_ELEMENTS: |
| 4564 __ mov_b(operand, value); | 4570 __ mov_b(operand, value); |
| 4565 break; | 4571 break; |
| 4566 case EXTERNAL_SHORT_ELEMENTS: | 4572 case EXTERNAL_SHORT_ELEMENTS: |
| 4567 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 4573 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 4574 case UINT16_ELEMENTS: |
| 4575 case INT16_ELEMENTS: |
| 4568 __ mov_w(operand, value); | 4576 __ mov_w(operand, value); |
| 4569 break; | 4577 break; |
| 4570 case EXTERNAL_INT_ELEMENTS: | 4578 case EXTERNAL_INT_ELEMENTS: |
| 4571 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 4579 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 4580 case UINT32_ELEMENTS: |
| 4581 case INT32_ELEMENTS: |
| 4572 __ mov(operand, value); | 4582 __ mov(operand, value); |
| 4573 break; | 4583 break; |
| 4574 case EXTERNAL_FLOAT_ELEMENTS: | 4584 case EXTERNAL_FLOAT_ELEMENTS: |
| 4575 case EXTERNAL_DOUBLE_ELEMENTS: | 4585 case EXTERNAL_DOUBLE_ELEMENTS: |
| 4586 case FLOAT32_ELEMENTS: |
| 4587 case FLOAT64_ELEMENTS: |
| 4576 case FAST_SMI_ELEMENTS: | 4588 case FAST_SMI_ELEMENTS: |
| 4577 case FAST_ELEMENTS: | 4589 case FAST_ELEMENTS: |
| 4578 case FAST_DOUBLE_ELEMENTS: | 4590 case FAST_DOUBLE_ELEMENTS: |
| 4579 case FAST_HOLEY_SMI_ELEMENTS: | 4591 case FAST_HOLEY_SMI_ELEMENTS: |
| 4580 case FAST_HOLEY_ELEMENTS: | 4592 case FAST_HOLEY_ELEMENTS: |
| 4581 case FAST_HOLEY_DOUBLE_ELEMENTS: | 4593 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 4582 case DICTIONARY_ELEMENTS: | 4594 case DICTIONARY_ELEMENTS: |
| 4583 case NON_STRICT_ARGUMENTS_ELEMENTS: | 4595 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 4584 UNREACHABLE(); | 4596 UNREACHABLE(); |
| 4585 break; | 4597 break; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4703 value, | 4715 value, |
| 4704 GetSaveFPRegsMode(), | 4716 GetSaveFPRegsMode(), |
| 4705 EMIT_REMEMBERED_SET, | 4717 EMIT_REMEMBERED_SET, |
| 4706 check_needed); | 4718 check_needed); |
| 4707 } | 4719 } |
| 4708 } | 4720 } |
| 4709 | 4721 |
| 4710 | 4722 |
| 4711 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { | 4723 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { |
| 4712 // By cases...external, fast-double, fast | 4724 // By cases...external, fast-double, fast |
| 4713 if (instr->is_external()) { | 4725 if (instr->is_typed_elements()) { |
| 4714 DoStoreKeyedExternalArray(instr); | 4726 DoStoreKeyedExternalArray(instr); |
| 4715 } else if (instr->hydrogen()->value()->representation().IsDouble()) { | 4727 } else if (instr->hydrogen()->value()->representation().IsDouble()) { |
| 4716 DoStoreKeyedFixedDoubleArray(instr); | 4728 DoStoreKeyedFixedDoubleArray(instr); |
| 4717 } else { | 4729 } else { |
| 4718 DoStoreKeyedFixedArray(instr); | 4730 DoStoreKeyedFixedArray(instr); |
| 4719 } | 4731 } |
| 4720 } | 4732 } |
| 4721 | 4733 |
| 4722 | 4734 |
| 4723 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4735 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4889 PushSafepointRegistersScope scope(this); | 4901 PushSafepointRegistersScope scope(this); |
| 4890 __ SmiTag(char_code); | 4902 __ SmiTag(char_code); |
| 4891 __ push(char_code); | 4903 __ push(char_code); |
| 4892 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context()); | 4904 CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr, instr->context()); |
| 4893 __ StoreToSafepointRegisterSlot(result, eax); | 4905 __ StoreToSafepointRegisterSlot(result, eax); |
| 4894 } | 4906 } |
| 4895 | 4907 |
| 4896 | 4908 |
| 4897 void LCodeGen::DoStringAdd(LStringAdd* instr) { | 4909 void LCodeGen::DoStringAdd(LStringAdd* instr) { |
| 4898 ASSERT(ToRegister(instr->context()).is(esi)); | 4910 ASSERT(ToRegister(instr->context()).is(esi)); |
| 4899 if (FLAG_new_string_add) { | 4911 ASSERT(ToRegister(instr->left()).is(edx)); |
| 4900 ASSERT(ToRegister(instr->left()).is(edx)); | 4912 ASSERT(ToRegister(instr->right()).is(eax)); |
| 4901 ASSERT(ToRegister(instr->right()).is(eax)); | 4913 StringAddStub stub(instr->hydrogen()->flags(), |
| 4902 NewStringAddStub stub(instr->hydrogen()->flags(), | 4914 instr->hydrogen()->pretenure_flag()); |
| 4903 instr->hydrogen()->pretenure_flag()); | 4915 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
| 4904 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | |
| 4905 } else { | |
| 4906 EmitPushTaggedOperand(instr->left()); | |
| 4907 EmitPushTaggedOperand(instr->right()); | |
| 4908 StringAddStub stub(instr->hydrogen()->flags()); | |
| 4909 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | |
| 4910 } | |
| 4911 } | 4916 } |
| 4912 | 4917 |
| 4913 | 4918 |
| 4914 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { | 4919 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { |
| 4915 LOperand* input = instr->value(); | 4920 LOperand* input = instr->value(); |
| 4916 LOperand* output = instr->result(); | 4921 LOperand* output = instr->result(); |
| 4917 ASSERT(input->IsRegister() || input->IsStackSlot()); | 4922 ASSERT(input->IsRegister() || input->IsStackSlot()); |
| 4918 ASSERT(output->IsDoubleRegister()); | 4923 ASSERT(output->IsDoubleRegister()); |
| 4919 if (CpuFeatures::IsSupported(SSE2)) { | 4924 if (CpuFeatures::IsSupported(SSE2)) { |
| 4920 CpuFeatureScope scope(masm(), SSE2); | 4925 CpuFeatureScope scope(masm(), SSE2); |
| (...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6351 FixedArray::kHeaderSize - kPointerSize)); | 6356 FixedArray::kHeaderSize - kPointerSize)); |
| 6352 __ bind(&done); | 6357 __ bind(&done); |
| 6353 } | 6358 } |
| 6354 | 6359 |
| 6355 | 6360 |
| 6356 #undef __ | 6361 #undef __ |
| 6357 | 6362 |
| 6358 } } // namespace v8::internal | 6363 } } // namespace v8::internal |
| 6359 | 6364 |
| 6360 #endif // V8_TARGET_ARCH_IA32 | 6365 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |