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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 STATIC_ASSERT(kNotStringTag != 0); | 297 STATIC_ASSERT(kNotStringTag != 0); |
298 __ testl(scratch, Immediate(kNotStringTag)); | 298 __ testl(scratch, Immediate(kNotStringTag)); |
299 __ j(not_zero, non_string_object); | 299 __ j(not_zero, non_string_object); |
300 } | 300 } |
301 | 301 |
302 | 302 |
303 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 303 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
304 Register receiver, | 304 Register receiver, |
305 Register scratch1, | 305 Register scratch1, |
306 Register scratch2, | 306 Register scratch2, |
307 Label* miss) { | 307 Label* miss, |
| 308 bool support_wrappers) { |
308 Label check_wrapper; | 309 Label check_wrapper; |
309 | 310 |
310 // Check if the object is a string leaving the instance type in the | 311 // Check if the object is a string leaving the instance type in the |
311 // scratch register. | 312 // scratch register. |
312 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); | 313 GenerateStringCheck(masm, receiver, scratch1, miss, |
| 314 support_wrappers ? &check_wrapper : miss); |
313 | 315 |
314 // Load length directly from the string. | 316 // Load length directly from the string. |
315 __ movq(rax, FieldOperand(receiver, String::kLengthOffset)); | 317 __ movq(rax, FieldOperand(receiver, String::kLengthOffset)); |
316 __ ret(0); | 318 __ ret(0); |
317 | 319 |
318 // Check if the object is a JSValue wrapper. | 320 if (support_wrappers) { |
319 __ bind(&check_wrapper); | 321 // Check if the object is a JSValue wrapper. |
320 __ cmpl(scratch1, Immediate(JS_VALUE_TYPE)); | 322 __ bind(&check_wrapper); |
321 __ j(not_equal, miss); | 323 __ cmpl(scratch1, Immediate(JS_VALUE_TYPE)); |
| 324 __ j(not_equal, miss); |
322 | 325 |
323 // Check if the wrapped value is a string and load the length | 326 // Check if the wrapped value is a string and load the length |
324 // directly if it is. | 327 // directly if it is. |
325 __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); | 328 __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
326 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); | 329 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
327 __ movq(rax, FieldOperand(scratch2, String::kLengthOffset)); | 330 __ movq(rax, FieldOperand(scratch2, String::kLengthOffset)); |
328 __ ret(0); | 331 __ ret(0); |
| 332 } |
329 } | 333 } |
330 | 334 |
331 | 335 |
332 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 336 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
333 Register receiver, | 337 Register receiver, |
334 Register result, | 338 Register result, |
335 Register scratch, | 339 Register scratch, |
336 Label* miss_label) { | 340 Label* miss_label) { |
337 __ TryGetFunctionPrototype(receiver, result, miss_label); | 341 __ TryGetFunctionPrototype(receiver, result, miss_label); |
338 if (!result.is(rax)) __ movq(rax, result); | 342 if (!result.is(rax)) __ movq(rax, result); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 } else if (FLAG_track_fields && representation.IsSmi()) { | 835 } else if (FLAG_track_fields && representation.IsSmi()) { |
832 __ JumpIfNotSmi(value_reg, miss_label); | 836 __ JumpIfNotSmi(value_reg, miss_label); |
833 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 837 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
834 __ JumpIfSmi(value_reg, miss_label); | 838 __ JumpIfSmi(value_reg, miss_label); |
835 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 839 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
836 Label do_store, heap_number; | 840 Label do_store, heap_number; |
837 __ AllocateHeapNumber(storage_reg, scratch1, slow); | 841 __ AllocateHeapNumber(storage_reg, scratch1, slow); |
838 | 842 |
839 __ JumpIfNotSmi(value_reg, &heap_number); | 843 __ JumpIfNotSmi(value_reg, &heap_number); |
840 __ SmiToInteger32(scratch1, value_reg); | 844 __ SmiToInteger32(scratch1, value_reg); |
841 __ Cvtlsi2sd(xmm0, scratch1); | 845 __ cvtlsi2sd(xmm0, scratch1); |
842 __ jmp(&do_store); | 846 __ jmp(&do_store); |
843 | 847 |
844 __ bind(&heap_number); | 848 __ bind(&heap_number); |
845 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), | 849 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), |
846 miss_label, DONT_DO_SMI_CHECK); | 850 miss_label, DONT_DO_SMI_CHECK); |
847 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); | 851 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); |
848 | 852 |
849 __ bind(&do_store); | 853 __ bind(&do_store); |
850 __ movsd(FieldOperand(storage_reg, HeapNumber::kValueOffset), xmm0); | 854 __ movsd(FieldOperand(storage_reg, HeapNumber::kValueOffset), xmm0); |
851 } | 855 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 __ movq(scratch1, | 989 __ movq(scratch1, |
986 FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); | 990 FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); |
987 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 991 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
988 __ movq(scratch1, FieldOperand(scratch1, offset)); | 992 __ movq(scratch1, FieldOperand(scratch1, offset)); |
989 } | 993 } |
990 | 994 |
991 // Store the value into the storage. | 995 // Store the value into the storage. |
992 Label do_store, heap_number; | 996 Label do_store, heap_number; |
993 __ JumpIfNotSmi(value_reg, &heap_number); | 997 __ JumpIfNotSmi(value_reg, &heap_number); |
994 __ SmiToInteger32(scratch2, value_reg); | 998 __ SmiToInteger32(scratch2, value_reg); |
995 __ Cvtlsi2sd(xmm0, scratch2); | 999 __ cvtlsi2sd(xmm0, scratch2); |
996 __ jmp(&do_store); | 1000 __ jmp(&do_store); |
997 | 1001 |
998 __ bind(&heap_number); | 1002 __ bind(&heap_number); |
999 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), | 1003 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), |
1000 miss_label, DONT_DO_SMI_CHECK); | 1004 miss_label, DONT_DO_SMI_CHECK); |
1001 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); | 1005 __ movsd(xmm0, FieldOperand(value_reg, HeapNumber::kValueOffset)); |
1002 __ bind(&do_store); | 1006 __ bind(&do_store); |
1003 __ movsd(FieldOperand(scratch1, HeapNumber::kValueOffset), xmm0); | 1007 __ movsd(FieldOperand(scratch1, HeapNumber::kValueOffset), xmm0); |
1004 // Return the value (register rax). | 1008 // Return the value (register rax). |
1005 ASSERT(value_reg.is(rax)); | 1009 ASSERT(value_reg.is(rax)); |
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3158 // ----------------------------------- | 3162 // ----------------------------------- |
3159 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3163 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3160 } | 3164 } |
3161 | 3165 |
3162 | 3166 |
3163 #undef __ | 3167 #undef __ |
3164 | 3168 |
3165 } } // namespace v8::internal | 3169 } } // namespace v8::internal |
3166 | 3170 |
3167 #endif // V8_TARGET_ARCH_X64 | 3171 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |