| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 } else if (r.IsDouble()) { | 1203 } else if (r.IsDouble()) { |
| 1204 XMMRegister reg = ToDoubleRegister(instr->InputAt(0)); | 1204 XMMRegister reg = ToDoubleRegister(instr->InputAt(0)); |
| 1205 __ xorpd(xmm0, xmm0); | 1205 __ xorpd(xmm0, xmm0); |
| 1206 __ ucomisd(reg, xmm0); | 1206 __ ucomisd(reg, xmm0); |
| 1207 EmitBranch(true_block, false_block, not_equal); | 1207 EmitBranch(true_block, false_block, not_equal); |
| 1208 } else { | 1208 } else { |
| 1209 ASSERT(r.IsTagged()); | 1209 ASSERT(r.IsTagged()); |
| 1210 Register reg = ToRegister(instr->InputAt(0)); | 1210 Register reg = ToRegister(instr->InputAt(0)); |
| 1211 HType type = instr->hydrogen()->type(); | 1211 HType type = instr->hydrogen()->type(); |
| 1212 if (type.IsBoolean()) { | 1212 if (type.IsBoolean()) { |
| 1213 __ Cmp(reg, Factory::true_value()); | 1213 __ CompareRoot(reg, Heap::kTrueValueRootIndex); |
| 1214 EmitBranch(true_block, false_block, equal); | 1214 EmitBranch(true_block, false_block, equal); |
| 1215 } else if (type.IsSmi()) { | 1215 } else if (type.IsSmi()) { |
| 1216 __ SmiCompare(reg, Smi::FromInt(0)); | 1216 __ SmiCompare(reg, Smi::FromInt(0)); |
| 1217 EmitBranch(true_block, false_block, not_equal); | 1217 EmitBranch(true_block, false_block, not_equal); |
| 1218 } else { | 1218 } else { |
| 1219 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1219 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| 1220 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1220 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1221 | 1221 |
| 1222 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); | 1222 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); |
| 1223 __ j(equal, false_label); | 1223 __ j(equal, false_label); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 instr->hydrogen()->type().IsSmi()) { | 1470 instr->hydrogen()->type().IsSmi()) { |
| 1471 // If the expression is known to untagged or smi, then it's definitely | 1471 // If the expression is known to untagged or smi, then it's definitely |
| 1472 // not null, and it can't be a an undetectable object. | 1472 // not null, and it can't be a an undetectable object. |
| 1473 // Jump directly to the false block. | 1473 // Jump directly to the false block. |
| 1474 EmitGoto(false_block); | 1474 EmitGoto(false_block); |
| 1475 return; | 1475 return; |
| 1476 } | 1476 } |
| 1477 | 1477 |
| 1478 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1478 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1479 | 1479 |
| 1480 __ Cmp(reg, Factory::null_value()); | 1480 __ CompareRoot(reg, Heap::kNullValueRootIndex); |
| 1481 if (instr->is_strict()) { | 1481 if (instr->is_strict()) { |
| 1482 EmitBranch(true_block, false_block, equal); | 1482 EmitBranch(true_block, false_block, equal); |
| 1483 } else { | 1483 } else { |
| 1484 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1484 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| 1485 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1485 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1486 __ j(equal, true_label); | 1486 __ j(equal, true_label); |
| 1487 __ Cmp(reg, Factory::undefined_value()); | 1487 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); |
| 1488 __ j(equal, true_label); | 1488 __ j(equal, true_label); |
| 1489 __ JumpIfSmi(reg, false_label); | 1489 __ JumpIfSmi(reg, false_label); |
| 1490 // Check for undetectable objects by looking in the bit field in | 1490 // Check for undetectable objects by looking in the bit field in |
| 1491 // the map. The object has already been smi checked. | 1491 // the map. The object has already been smi checked. |
| 1492 Register scratch = ToRegister(instr->TempAt(0)); | 1492 Register scratch = ToRegister(instr->TempAt(0)); |
| 1493 __ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset)); | 1493 __ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset)); |
| 1494 __ testb(FieldOperand(scratch, Map::kBitFieldOffset), | 1494 __ testb(FieldOperand(scratch, Map::kBitFieldOffset), |
| 1495 Immediate(1 << Map::kIsUndetectable)); | 1495 Immediate(1 << Map::kIsUndetectable)); |
| 1496 EmitBranch(true_block, false_block, not_zero); | 1496 EmitBranch(true_block, false_block, not_zero); |
| 1497 } | 1497 } |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2085 __ bind(&done); | 2085 __ bind(&done); |
| 2086 } | 2086 } |
| 2087 | 2087 |
| 2088 | 2088 |
| 2089 void LCodeGen::DoLoadElements(LLoadElements* instr) { | 2089 void LCodeGen::DoLoadElements(LLoadElements* instr) { |
| 2090 Register result = ToRegister(instr->result()); | 2090 Register result = ToRegister(instr->result()); |
| 2091 Register input = ToRegister(instr->InputAt(0)); | 2091 Register input = ToRegister(instr->InputAt(0)); |
| 2092 __ movq(result, FieldOperand(input, JSObject::kElementsOffset)); | 2092 __ movq(result, FieldOperand(input, JSObject::kElementsOffset)); |
| 2093 if (FLAG_debug_code) { | 2093 if (FLAG_debug_code) { |
| 2094 NearLabel done; | 2094 NearLabel done; |
| 2095 __ Cmp(FieldOperand(result, HeapObject::kMapOffset), | 2095 __ CompareRoot(FieldOperand(result, HeapObject::kMapOffset), |
| 2096 Factory::fixed_array_map()); | 2096 Heap::kFixedArrayMapRootIndex); |
| 2097 __ j(equal, &done); | 2097 __ j(equal, &done); |
| 2098 __ Cmp(FieldOperand(result, HeapObject::kMapOffset), | 2098 __ CompareRoot(FieldOperand(result, HeapObject::kMapOffset), |
| 2099 Factory::external_pixel_array_map()); | 2099 Heap::kExternalPixelArrayMapRootIndex); |
| 2100 __ j(equal, &done); | 2100 __ j(equal, &done); |
| 2101 __ Cmp(FieldOperand(result, HeapObject::kMapOffset), | 2101 __ CompareRoot(FieldOperand(result, HeapObject::kMapOffset), |
| 2102 Factory::fixed_cow_array_map()); | 2102 Heap::kFixedCOWArrayMapRootIndex); |
| 2103 __ Check(equal, "Check for fast elements failed."); | 2103 __ Check(equal, "Check for fast elements failed."); |
| 2104 __ bind(&done); | 2104 __ bind(&done); |
| 2105 } | 2105 } |
| 2106 } | 2106 } |
| 2107 | 2107 |
| 2108 | 2108 |
| 2109 void LCodeGen::DoLoadExternalArrayPointer( | 2109 void LCodeGen::DoLoadExternalArrayPointer( |
| 2110 LLoadExternalArrayPointer* instr) { | 2110 LLoadExternalArrayPointer* instr) { |
| 2111 Register result = ToRegister(instr->result()); | 2111 Register result = ToRegister(instr->result()); |
| 2112 Register input = ToRegister(instr->InputAt(0)); | 2112 Register input = ToRegister(instr->InputAt(0)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2139 Register result = ToRegister(instr->result()); | 2139 Register result = ToRegister(instr->result()); |
| 2140 ASSERT(result.is(elements)); | 2140 ASSERT(result.is(elements)); |
| 2141 | 2141 |
| 2142 // Load the result. | 2142 // Load the result. |
| 2143 __ movq(result, FieldOperand(elements, | 2143 __ movq(result, FieldOperand(elements, |
| 2144 key, | 2144 key, |
| 2145 times_pointer_size, | 2145 times_pointer_size, |
| 2146 FixedArray::kHeaderSize)); | 2146 FixedArray::kHeaderSize)); |
| 2147 | 2147 |
| 2148 // Check for the hole value. | 2148 // Check for the hole value. |
| 2149 __ Cmp(result, Factory::the_hole_value()); | 2149 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
| 2150 DeoptimizeIf(equal, instr->environment()); | 2150 DeoptimizeIf(equal, instr->environment()); |
| 2151 } | 2151 } |
| 2152 | 2152 |
| 2153 | 2153 |
| 2154 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { | 2154 void LCodeGen::DoLoadPixelArrayElement(LLoadPixelArrayElement* instr) { |
| 2155 Register external_elements = ToRegister(instr->external_pointer()); | 2155 Register external_elements = ToRegister(instr->external_pointer()); |
| 2156 Register key = ToRegister(instr->key()); | 2156 Register key = ToRegister(instr->key()); |
| 2157 Register result = ToRegister(instr->result()); | 2157 Register result = ToRegister(instr->result()); |
| 2158 ASSERT(result.is(external_elements)); | 2158 ASSERT(result.is(external_elements)); |
| 2159 | 2159 |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3427 // space for nested functions that don't need literals cloning. | 3427 // space for nested functions that don't need literals cloning. |
| 3428 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); | 3428 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); |
| 3429 bool pretenure = instr->hydrogen()->pretenure(); | 3429 bool pretenure = instr->hydrogen()->pretenure(); |
| 3430 if (shared_info->num_literals() == 0 && !pretenure) { | 3430 if (shared_info->num_literals() == 0 && !pretenure) { |
| 3431 FastNewClosureStub stub; | 3431 FastNewClosureStub stub; |
| 3432 __ Push(shared_info); | 3432 __ Push(shared_info); |
| 3433 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3433 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3434 } else { | 3434 } else { |
| 3435 __ push(rsi); | 3435 __ push(rsi); |
| 3436 __ Push(shared_info); | 3436 __ Push(shared_info); |
| 3437 __ Push(pretenure ? Factory::true_value() : Factory::false_value()); | 3437 __ PushRoot(pretenure ? |
| 3438 Heap::kTrueValueRootIndex : |
| 3439 Heap::kFalseValueRootIndex); |
| 3438 CallRuntime(Runtime::kNewClosure, 3, instr); | 3440 CallRuntime(Runtime::kNewClosure, 3, instr); |
| 3439 } | 3441 } |
| 3440 } | 3442 } |
| 3441 | 3443 |
| 3442 | 3444 |
| 3443 void LCodeGen::DoTypeof(LTypeof* instr) { | 3445 void LCodeGen::DoTypeof(LTypeof* instr) { |
| 3444 LOperand* input = instr->InputAt(0); | 3446 LOperand* input = instr->InputAt(0); |
| 3445 if (input->IsConstantOperand()) { | 3447 if (input->IsConstantOperand()) { |
| 3446 __ Push(ToHandle(LConstantOperand::cast(input))); | 3448 __ Push(ToHandle(LConstantOperand::cast(input))); |
| 3447 } else if (input->IsRegister()) { | 3449 } else if (input->IsRegister()) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3510 } | 3512 } |
| 3511 | 3513 |
| 3512 | 3514 |
| 3513 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 3515 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| 3514 Label* false_label, | 3516 Label* false_label, |
| 3515 Register input, | 3517 Register input, |
| 3516 Handle<String> type_name) { | 3518 Handle<String> type_name) { |
| 3517 Condition final_branch_condition = no_condition; | 3519 Condition final_branch_condition = no_condition; |
| 3518 if (type_name->Equals(Heap::number_symbol())) { | 3520 if (type_name->Equals(Heap::number_symbol())) { |
| 3519 __ JumpIfSmi(input, true_label); | 3521 __ JumpIfSmi(input, true_label); |
| 3520 __ Cmp(FieldOperand(input, HeapObject::kMapOffset), | 3522 __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset), |
| 3521 Factory::heap_number_map()); | 3523 Heap::kHeapNumberMapRootIndex); |
| 3524 |
| 3522 final_branch_condition = equal; | 3525 final_branch_condition = equal; |
| 3523 | 3526 |
| 3524 } else if (type_name->Equals(Heap::string_symbol())) { | 3527 } else if (type_name->Equals(Heap::string_symbol())) { |
| 3525 __ JumpIfSmi(input, false_label); | 3528 __ JumpIfSmi(input, false_label); |
| 3526 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); | 3529 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); |
| 3527 __ j(above_equal, false_label); | 3530 __ j(above_equal, false_label); |
| 3528 __ testb(FieldOperand(input, Map::kBitFieldOffset), | 3531 __ testb(FieldOperand(input, Map::kBitFieldOffset), |
| 3529 Immediate(1 << Map::kIsUndetectable)); | 3532 Immediate(1 << Map::kIsUndetectable)); |
| 3530 final_branch_condition = zero; | 3533 final_branch_condition = zero; |
| 3531 | 3534 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3691 RegisterEnvironmentForDeoptimization(environment); | 3694 RegisterEnvironmentForDeoptimization(environment); |
| 3692 ASSERT(osr_pc_offset_ == -1); | 3695 ASSERT(osr_pc_offset_ == -1); |
| 3693 osr_pc_offset_ = masm()->pc_offset(); | 3696 osr_pc_offset_ = masm()->pc_offset(); |
| 3694 } | 3697 } |
| 3695 | 3698 |
| 3696 #undef __ | 3699 #undef __ |
| 3697 | 3700 |
| 3698 } } // namespace v8::internal | 3701 } } // namespace v8::internal |
| 3699 | 3702 |
| 3700 #endif // V8_TARGET_ARCH_X64 | 3703 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |