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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 STATIC_ASSERT(kNotStringTag != 0); | 322 STATIC_ASSERT(kNotStringTag != 0); |
323 __ test(scratch, Immediate(kNotStringTag)); | 323 __ test(scratch, Immediate(kNotStringTag)); |
324 __ j(not_zero, non_string_object); | 324 __ j(not_zero, non_string_object); |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, | 328 void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
329 Register receiver, | 329 Register receiver, |
330 Register scratch1, | 330 Register scratch1, |
331 Register scratch2, | 331 Register scratch2, |
332 Label* miss) { | 332 Label* miss, |
| 333 bool support_wrappers) { |
333 Label check_wrapper; | 334 Label check_wrapper; |
334 | 335 |
335 // Check if the object is a string leaving the instance type in the | 336 // Check if the object is a string leaving the instance type in the |
336 // scratch register. | 337 // scratch register. |
337 GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); | 338 GenerateStringCheck(masm, receiver, scratch1, miss, |
| 339 support_wrappers ? &check_wrapper : miss); |
338 | 340 |
339 // Load length from the string and convert to a smi. | 341 // Load length from the string and convert to a smi. |
340 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); | 342 __ mov(eax, FieldOperand(receiver, String::kLengthOffset)); |
341 __ ret(0); | 343 __ ret(0); |
342 | 344 |
343 // Check if the object is a JSValue wrapper. | 345 if (support_wrappers) { |
344 __ bind(&check_wrapper); | 346 // Check if the object is a JSValue wrapper. |
345 __ cmp(scratch1, JS_VALUE_TYPE); | 347 __ bind(&check_wrapper); |
346 __ j(not_equal, miss); | 348 __ cmp(scratch1, JS_VALUE_TYPE); |
| 349 __ j(not_equal, miss); |
347 | 350 |
348 // Check if the wrapped value is a string and load the length | 351 // Check if the wrapped value is a string and load the length |
349 // directly if it is. | 352 // directly if it is. |
350 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); | 353 __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
351 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); | 354 GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
352 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); | 355 __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); |
353 __ ret(0); | 356 __ ret(0); |
| 357 } |
354 } | 358 } |
355 | 359 |
356 | 360 |
357 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, | 361 void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm, |
358 Register receiver, | 362 Register receiver, |
359 Register scratch1, | 363 Register scratch1, |
360 Register scratch2, | 364 Register scratch2, |
361 Label* miss_label) { | 365 Label* miss_label) { |
362 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 366 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
363 __ mov(eax, scratch1); | 367 __ mov(eax, scratch1); |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { | 855 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
852 __ JumpIfSmi(value_reg, miss_label); | 856 __ JumpIfSmi(value_reg, miss_label); |
853 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 857 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
854 Label do_store, heap_number; | 858 Label do_store, heap_number; |
855 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, slow); | 859 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, slow); |
856 | 860 |
857 __ JumpIfNotSmi(value_reg, &heap_number); | 861 __ JumpIfNotSmi(value_reg, &heap_number); |
858 __ SmiUntag(value_reg); | 862 __ SmiUntag(value_reg); |
859 if (CpuFeatures::IsSupported(SSE2)) { | 863 if (CpuFeatures::IsSupported(SSE2)) { |
860 CpuFeatureScope use_sse2(masm, SSE2); | 864 CpuFeatureScope use_sse2(masm, SSE2); |
861 __ Cvtsi2sd(xmm0, value_reg); | 865 __ cvtsi2sd(xmm0, value_reg); |
862 } else { | 866 } else { |
863 __ push(value_reg); | 867 __ push(value_reg); |
864 __ fild_s(Operand(esp, 0)); | 868 __ fild_s(Operand(esp, 0)); |
865 __ pop(value_reg); | 869 __ pop(value_reg); |
866 } | 870 } |
867 __ SmiTag(value_reg); | 871 __ SmiTag(value_reg); |
868 __ jmp(&do_store); | 872 __ jmp(&do_store); |
869 | 873 |
870 __ bind(&heap_number); | 874 __ bind(&heap_number); |
871 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), | 875 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 int offset = index * kPointerSize + FixedArray::kHeaderSize; | 1034 int offset = index * kPointerSize + FixedArray::kHeaderSize; |
1031 __ mov(scratch1, FieldOperand(scratch1, offset)); | 1035 __ mov(scratch1, FieldOperand(scratch1, offset)); |
1032 } | 1036 } |
1033 | 1037 |
1034 // Store the value into the storage. | 1038 // Store the value into the storage. |
1035 Label do_store, heap_number; | 1039 Label do_store, heap_number; |
1036 __ JumpIfNotSmi(value_reg, &heap_number); | 1040 __ JumpIfNotSmi(value_reg, &heap_number); |
1037 __ SmiUntag(value_reg); | 1041 __ SmiUntag(value_reg); |
1038 if (CpuFeatures::IsSupported(SSE2)) { | 1042 if (CpuFeatures::IsSupported(SSE2)) { |
1039 CpuFeatureScope use_sse2(masm, SSE2); | 1043 CpuFeatureScope use_sse2(masm, SSE2); |
1040 __ Cvtsi2sd(xmm0, value_reg); | 1044 __ cvtsi2sd(xmm0, value_reg); |
1041 } else { | 1045 } else { |
1042 __ push(value_reg); | 1046 __ push(value_reg); |
1043 __ fild_s(Operand(esp, 0)); | 1047 __ fild_s(Operand(esp, 0)); |
1044 __ pop(value_reg); | 1048 __ pop(value_reg); |
1045 } | 1049 } |
1046 __ SmiTag(value_reg); | 1050 __ SmiTag(value_reg); |
1047 __ jmp(&do_store); | 1051 __ jmp(&do_store); |
1048 __ bind(&heap_number); | 1052 __ bind(&heap_number); |
1049 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), | 1053 __ CheckMap(value_reg, masm->isolate()->factory()->heap_number_map(), |
1050 miss_label, DONT_DO_SMI_CHECK); | 1054 miss_label, DONT_DO_SMI_CHECK); |
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3264 // ----------------------------------- | 3268 // ----------------------------------- |
3265 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3269 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3266 } | 3270 } |
3267 | 3271 |
3268 | 3272 |
3269 #undef __ | 3273 #undef __ |
3270 | 3274 |
3271 } } // namespace v8::internal | 3275 } } // namespace v8::internal |
3272 | 3276 |
3273 #endif // V8_TARGET_ARCH_IA32 | 3277 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |