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 2091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2102 | 2102 |
2103 __ CmpObjectType(input, TestType(instr->hydrogen()), temp); | 2103 __ CmpObjectType(input, TestType(instr->hydrogen()), temp); |
2104 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); | 2104 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); |
2105 } | 2105 } |
2106 | 2106 |
2107 | 2107 |
2108 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { | 2108 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { |
2109 Register input = ToRegister(instr->value()); | 2109 Register input = ToRegister(instr->value()); |
2110 Register result = ToRegister(instr->result()); | 2110 Register result = ToRegister(instr->result()); |
2111 | 2111 |
2112 __ AbortIfNotString(input); | 2112 __ AssertString(input); |
2113 | 2113 |
2114 __ mov(result, FieldOperand(input, String::kHashFieldOffset)); | 2114 __ mov(result, FieldOperand(input, String::kHashFieldOffset)); |
2115 __ IndexFromHash(result, result); | 2115 __ IndexFromHash(result, result); |
2116 } | 2116 } |
2117 | 2117 |
2118 | 2118 |
2119 void LCodeGen::DoHasCachedArrayIndexAndBranch( | 2119 void LCodeGen::DoHasCachedArrayIndexAndBranch( |
2120 LHasCachedArrayIndexAndBranch* instr) { | 2120 LHasCachedArrayIndexAndBranch* instr) { |
2121 Register input = ToRegister(instr->value()); | 2121 Register input = ToRegister(instr->value()); |
2122 | 2122 |
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4038 if (instr->index()->IsConstantOperand()) { | 4038 if (instr->index()->IsConstantOperand()) { |
4039 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); | 4039 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); |
4040 __ push(Immediate(Smi::FromInt(const_index))); | 4040 __ push(Immediate(Smi::FromInt(const_index))); |
4041 } else { | 4041 } else { |
4042 Register index = ToRegister(instr->index()); | 4042 Register index = ToRegister(instr->index()); |
4043 __ SmiTag(index); | 4043 __ SmiTag(index); |
4044 __ push(index); | 4044 __ push(index); |
4045 } | 4045 } |
4046 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, | 4046 CallRuntimeFromDeferred(Runtime::kStringCharCodeAt, 2, |
4047 instr, instr->context()); | 4047 instr, instr->context()); |
4048 if (FLAG_debug_code) { | 4048 __ AssertSmi(eax); |
4049 __ AbortIfNotSmi(eax); | |
4050 } | |
4051 __ SmiUntag(eax); | 4049 __ SmiUntag(eax); |
4052 __ StoreToSafepointRegisterSlot(result, eax); | 4050 __ StoreToSafepointRegisterSlot(result, eax); |
4053 } | 4051 } |
4054 | 4052 |
4055 | 4053 |
4056 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { | 4054 void LCodeGen::DoStringCharFromCode(LStringCharFromCode* instr) { |
4057 class DeferredStringCharFromCode: public LDeferredCode { | 4055 class DeferredStringCharFromCode: public LDeferredCode { |
4058 public: | 4056 public: |
4059 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) | 4057 DeferredStringCharFromCode(LCodeGen* codegen, LStringCharFromCode* instr) |
4060 : LDeferredCode(codegen), instr_(instr) { } | 4058 : LDeferredCode(codegen), instr_(instr) { } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4294 } | 4292 } |
4295 | 4293 |
4296 | 4294 |
4297 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { | 4295 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
4298 LOperand* input = instr->value(); | 4296 LOperand* input = instr->value(); |
4299 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 4297 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
4300 if (instr->needs_check()) { | 4298 if (instr->needs_check()) { |
4301 __ test(ToRegister(input), Immediate(kSmiTagMask)); | 4299 __ test(ToRegister(input), Immediate(kSmiTagMask)); |
4302 DeoptimizeIf(not_zero, instr->environment()); | 4300 DeoptimizeIf(not_zero, instr->environment()); |
4303 } else { | 4301 } else { |
4304 if (FLAG_debug_code) { | 4302 __ AssertSmi(ToRegister(input)); |
4305 __ AbortIfNotSmi(ToRegister(input)); | |
4306 } | |
4307 } | 4303 } |
4308 __ SmiUntag(ToRegister(input)); | 4304 __ SmiUntag(ToRegister(input)); |
4309 } | 4305 } |
4310 | 4306 |
4311 | 4307 |
4312 void LCodeGen::EmitNumberUntagD(Register input_reg, | 4308 void LCodeGen::EmitNumberUntagD(Register input_reg, |
4313 Register temp_reg, | 4309 Register temp_reg, |
4314 XMMRegister result_reg, | 4310 XMMRegister result_reg, |
4315 bool deoptimize_on_undefined, | 4311 bool deoptimize_on_undefined, |
4316 bool deoptimize_on_minus_zero, | 4312 bool deoptimize_on_minus_zero, |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4829 __ Abort("Allocated object is not in new-space"); | 4825 __ Abort("Allocated object is not in new-space"); |
4830 __ bind(&is_in_new_space); | 4826 __ bind(&is_in_new_space); |
4831 } | 4827 } |
4832 | 4828 |
4833 // Load the initial map. | 4829 // Load the initial map. |
4834 Register map = scratch; | 4830 Register map = scratch; |
4835 __ LoadHeapObject(scratch, constructor); | 4831 __ LoadHeapObject(scratch, constructor); |
4836 __ mov(map, FieldOperand(scratch, JSFunction::kPrototypeOrInitialMapOffset)); | 4832 __ mov(map, FieldOperand(scratch, JSFunction::kPrototypeOrInitialMapOffset)); |
4837 | 4833 |
4838 if (FLAG_debug_code) { | 4834 if (FLAG_debug_code) { |
4839 __ AbortIfSmi(map); | 4835 __ AssertNotSmi(map); |
4840 __ cmpb(FieldOperand(map, Map::kInstanceSizeOffset), | 4836 __ cmpb(FieldOperand(map, Map::kInstanceSizeOffset), |
4841 instance_size >> kPointerSizeLog2); | 4837 instance_size >> kPointerSizeLog2); |
4842 __ Assert(equal, "Unexpected instance size"); | 4838 __ Assert(equal, "Unexpected instance size"); |
4843 __ cmpb(FieldOperand(map, Map::kPreAllocatedPropertyFieldsOffset), | 4839 __ cmpb(FieldOperand(map, Map::kPreAllocatedPropertyFieldsOffset), |
4844 initial_map->pre_allocated_property_fields()); | 4840 initial_map->pre_allocated_property_fields()); |
4845 __ Assert(equal, "Unexpected pre-allocated property fields count"); | 4841 __ Assert(equal, "Unexpected pre-allocated property fields count"); |
4846 __ cmpb(FieldOperand(map, Map::kUnusedPropertyFieldsOffset), | 4842 __ cmpb(FieldOperand(map, Map::kUnusedPropertyFieldsOffset), |
4847 initial_map->unused_property_fields()); | 4843 initial_map->unused_property_fields()); |
4848 __ Assert(equal, "Unexpected unused property fields count"); | 4844 __ Assert(equal, "Unexpected unused property fields count"); |
4849 __ cmpb(FieldOperand(map, Map::kInObjectPropertiesOffset), | 4845 __ cmpb(FieldOperand(map, Map::kInObjectPropertiesOffset), |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5544 FixedArray::kHeaderSize - kPointerSize)); | 5540 FixedArray::kHeaderSize - kPointerSize)); |
5545 __ bind(&done); | 5541 __ bind(&done); |
5546 } | 5542 } |
5547 | 5543 |
5548 | 5544 |
5549 #undef __ | 5545 #undef __ |
5550 | 5546 |
5551 } } // namespace v8::internal | 5547 } } // namespace v8::internal |
5552 | 5548 |
5553 #endif // V8_TARGET_ARCH_IA32 | 5549 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |