| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 } | 970 } |
| 971 } | 971 } |
| 972 | 972 |
| 973 | 973 |
| 974 void LCodeGen::DoConstantT(LConstantT* instr) { | 974 void LCodeGen::DoConstantT(LConstantT* instr) { |
| 975 ASSERT(instr->result()->IsRegister()); | 975 ASSERT(instr->result()->IsRegister()); |
| 976 __ Set(ToRegister(instr->result()), Immediate(instr->value())); | 976 __ Set(ToRegister(instr->result()), Immediate(instr->value())); |
| 977 } | 977 } |
| 978 | 978 |
| 979 | 979 |
| 980 void LCodeGen::DoArrayLength(LArrayLength* instr) { | 980 void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { |
| 981 Register result = ToRegister(instr->result()); | 981 Register result = ToRegister(instr->result()); |
| 982 | 982 Register array = ToRegister(instr->input()); |
| 983 if (instr->hydrogen()->value()->IsLoadElements()) { | 983 __ mov(result, FieldOperand(array, JSArray::kLengthOffset)); |
| 984 // We load the length directly from the elements array. | |
| 985 Register elements = ToRegister(instr->input()); | |
| 986 __ mov(result, FieldOperand(elements, FixedArray::kLengthOffset)); | |
| 987 } else { | |
| 988 // Check that the receiver really is an array. | |
| 989 Register array = ToRegister(instr->input()); | |
| 990 Register temporary = ToRegister(instr->temporary()); | |
| 991 __ CmpObjectType(array, JS_ARRAY_TYPE, temporary); | |
| 992 DeoptimizeIf(not_equal, instr->environment()); | |
| 993 | |
| 994 // Load length directly from the array. | |
| 995 __ mov(result, FieldOperand(array, JSArray::kLengthOffset)); | |
| 996 } | |
| 997 } | 984 } |
| 998 | 985 |
| 999 | 986 |
| 987 void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { |
| 988 Register result = ToRegister(instr->result()); |
| 989 Register array = ToRegister(instr->input()); |
| 990 __ mov(result, FieldOperand(array, FixedArray::kLengthOffset)); |
| 991 } |
| 992 |
| 993 |
| 1000 void LCodeGen::DoValueOf(LValueOf* instr) { | 994 void LCodeGen::DoValueOf(LValueOf* instr) { |
| 1001 Register input = ToRegister(instr->input()); | 995 Register input = ToRegister(instr->input()); |
| 1002 Register result = ToRegister(instr->result()); | 996 Register result = ToRegister(instr->result()); |
| 1003 Register map = ToRegister(instr->temporary()); | 997 Register map = ToRegister(instr->temporary()); |
| 1004 ASSERT(input.is(result)); | 998 ASSERT(input.is(result)); |
| 1005 NearLabel done; | 999 NearLabel done; |
| 1006 // If the object is a smi return the object. | 1000 // If the object is a smi return the object. |
| 1007 __ test(input, Immediate(kSmiTagMask)); | 1001 __ test(input, Immediate(kSmiTagMask)); |
| 1008 __ j(zero, &done); | 1002 __ j(zero, &done); |
| 1009 | 1003 |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2926 DeoptimizeIf(instr->condition(), instr->environment()); | 2920 DeoptimizeIf(instr->condition(), instr->environment()); |
| 2927 } | 2921 } |
| 2928 | 2922 |
| 2929 | 2923 |
| 2930 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { | 2924 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { |
| 2931 Register input = ToRegister(instr->input()); | 2925 Register input = ToRegister(instr->input()); |
| 2932 Register temp = ToRegister(instr->temp()); | 2926 Register temp = ToRegister(instr->temp()); |
| 2933 InstanceType first = instr->hydrogen()->first(); | 2927 InstanceType first = instr->hydrogen()->first(); |
| 2934 InstanceType last = instr->hydrogen()->last(); | 2928 InstanceType last = instr->hydrogen()->last(); |
| 2935 | 2929 |
| 2936 __ test(input, Immediate(kSmiTagMask)); | |
| 2937 DeoptimizeIf(zero, instr->environment()); | |
| 2938 | |
| 2939 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); | 2930 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); |
| 2940 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), | 2931 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), |
| 2941 static_cast<int8_t>(first)); | 2932 static_cast<int8_t>(first)); |
| 2942 | 2933 |
| 2943 // If there is only one type in the interval check for equality. | 2934 // If there is only one type in the interval check for equality. |
| 2944 if (first == last) { | 2935 if (first == last) { |
| 2945 DeoptimizeIf(not_equal, instr->environment()); | 2936 DeoptimizeIf(not_equal, instr->environment()); |
| 2946 } else { | 2937 } else { |
| 2947 DeoptimizeIf(below, instr->environment()); | 2938 DeoptimizeIf(below, instr->environment()); |
| 2948 // Omit check for the last type. | 2939 // Omit check for the last type. |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3309 ASSERT(!environment->HasBeenRegistered()); | 3300 ASSERT(!environment->HasBeenRegistered()); |
| 3310 RegisterEnvironmentForDeoptimization(environment); | 3301 RegisterEnvironmentForDeoptimization(environment); |
| 3311 ASSERT(osr_pc_offset_ == -1); | 3302 ASSERT(osr_pc_offset_ == -1); |
| 3312 osr_pc_offset_ = masm()->pc_offset(); | 3303 osr_pc_offset_ = masm()->pc_offset(); |
| 3313 } | 3304 } |
| 3314 | 3305 |
| 3315 | 3306 |
| 3316 #undef __ | 3307 #undef __ |
| 3317 | 3308 |
| 3318 } } // namespace v8::internal | 3309 } } // namespace v8::internal |
| OLD | NEW |