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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 Label check_pixel_array, probe_dictionary, check_number_dictionary; | 308 Label check_pixel_array, probe_dictionary, check_number_dictionary; |
309 | 309 |
310 // Check that the object isn't a smi. | 310 // Check that the object isn't a smi. |
311 __ test(edx, Immediate(kSmiTagMask)); | 311 __ test(edx, Immediate(kSmiTagMask)); |
312 __ j(zero, &slow, not_taken); | 312 __ j(zero, &slow, not_taken); |
313 | 313 |
314 // Get the map of the receiver. | 314 // Get the map of the receiver. |
315 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset)); | 315 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset)); |
316 | 316 |
317 // Check bit field. | 317 // Check bit field. |
318 __ movzx_b(ebx, FieldOperand(ecx, Map::kBitFieldOffset)); | 318 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), kSlowCaseBitFieldMask); |
319 __ test(ebx, Immediate(kSlowCaseBitFieldMask)); | |
320 __ j(not_zero, &slow, not_taken); | 319 __ j(not_zero, &slow, not_taken); |
321 // Check that the object is some kind of JS object EXCEPT JS Value type. | 320 // Check that the object is some kind of JS object EXCEPT JS Value type. |
322 // In the case that the object is a value-wrapper object, | 321 // In the case that the object is a value-wrapper object, |
323 // we enter the runtime system to make sure that indexing | 322 // we enter the runtime system to make sure that indexing |
324 // into string objects work as intended. | 323 // into string objects work as intended. |
325 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); | 324 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
326 __ CmpInstanceType(ecx, JS_OBJECT_TYPE); | 325 __ CmpInstanceType(ecx, JS_OBJECT_TYPE); |
327 __ j(below, &slow, not_taken); | 326 __ j(below, &slow, not_taken); |
328 // Check that the key is a smi. | 327 // Check that the key is a smi. |
329 __ test(eax, Immediate(kSmiTagMask)); | 328 __ test(eax, Immediate(kSmiTagMask)); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // eax: key | 402 // eax: key |
404 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, ecx); | 403 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, ecx); |
405 __ j(above_equal, &slow); | 404 __ j(above_equal, &slow); |
406 // Is the string an array index, with cached numeric value? | 405 // Is the string an array index, with cached numeric value? |
407 __ mov(ebx, FieldOperand(eax, String::kHashFieldOffset)); | 406 __ mov(ebx, FieldOperand(eax, String::kHashFieldOffset)); |
408 __ test(ebx, Immediate(String::kIsArrayIndexMask)); | 407 __ test(ebx, Immediate(String::kIsArrayIndexMask)); |
409 __ j(not_zero, &index_string, not_taken); | 408 __ j(not_zero, &index_string, not_taken); |
410 | 409 |
411 // Is the string a symbol? | 410 // Is the string a symbol? |
412 // ecx: key map. | 411 // ecx: key map. |
413 __ movzx_b(ebx, FieldOperand(ecx, Map::kInstanceTypeOffset)); | |
414 ASSERT(kSymbolTag != 0); | 412 ASSERT(kSymbolTag != 0); |
415 __ test(ebx, Immediate(kIsSymbolMask)); | 413 __ test_b(FieldOperand(ecx, Map::kInstanceTypeOffset), kIsSymbolMask); |
416 __ j(zero, &slow, not_taken); | 414 __ j(zero, &slow, not_taken); |
417 | 415 |
418 // If the receiver is a fast-case object, check the keyed lookup | 416 // If the receiver is a fast-case object, check the keyed lookup |
419 // cache. Otherwise probe the dictionary. | 417 // cache. Otherwise probe the dictionary. |
420 __ mov(ebx, FieldOperand(edx, JSObject::kPropertiesOffset)); | 418 __ mov(ebx, FieldOperand(edx, JSObject::kPropertiesOffset)); |
421 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), | 419 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), |
422 Immediate(Factory::hash_table_map())); | 420 Immediate(Factory::hash_table_map())); |
423 __ j(equal, &probe_dictionary); | 421 __ j(equal, &probe_dictionary); |
424 | 422 |
425 // Load the map of the receiver, compute the keyed lookup cache hash | 423 // Load the map of the receiver, compute the keyed lookup cache hash |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 555 |
558 // Check that the key is a smi. | 556 // Check that the key is a smi. |
559 __ test(eax, Immediate(kSmiTagMask)); | 557 __ test(eax, Immediate(kSmiTagMask)); |
560 __ j(not_zero, &slow, not_taken); | 558 __ j(not_zero, &slow, not_taken); |
561 | 559 |
562 // Get the map of the receiver. | 560 // Get the map of the receiver. |
563 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset)); | 561 __ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset)); |
564 // Check that the receiver does not require access checks. We need | 562 // Check that the receiver does not require access checks. We need |
565 // to check this explicitly since this generic stub does not perform | 563 // to check this explicitly since this generic stub does not perform |
566 // map checks. | 564 // map checks. |
567 __ movzx_b(ebx, FieldOperand(ecx, Map::kBitFieldOffset)); | 565 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), |
568 __ test(ebx, Immediate(1 << Map::kIsAccessCheckNeeded)); | 566 1 << Map::kIsAccessCheckNeeded); |
569 __ j(not_zero, &slow, not_taken); | 567 __ j(not_zero, &slow, not_taken); |
570 | 568 |
571 __ CmpInstanceType(ecx, JS_OBJECT_TYPE); | 569 __ CmpInstanceType(ecx, JS_OBJECT_TYPE); |
572 __ j(not_equal, &slow, not_taken); | 570 __ j(not_equal, &slow, not_taken); |
573 | 571 |
574 // Check that the elements array is the appropriate type of | 572 // Check that the elements array is the appropriate type of |
575 // ExternalArray. | 573 // ExternalArray. |
576 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); | 574 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); |
577 Handle<Map> map(Heap::MapForExternalArrayType(array_type)); | 575 Handle<Map> map(Heap::MapForExternalArrayType(array_type)); |
578 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), | 576 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 // ----------------------------------- | 745 // ----------------------------------- |
748 Label slow, fast, array, extra, check_pixel_array; | 746 Label slow, fast, array, extra, check_pixel_array; |
749 | 747 |
750 // Check that the object isn't a smi. | 748 // Check that the object isn't a smi. |
751 __ test(edx, Immediate(kSmiTagMask)); | 749 __ test(edx, Immediate(kSmiTagMask)); |
752 __ j(zero, &slow, not_taken); | 750 __ j(zero, &slow, not_taken); |
753 // Get the map from the receiver. | 751 // Get the map from the receiver. |
754 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); | 752 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); |
755 // Check that the receiver does not require access checks. We need | 753 // Check that the receiver does not require access checks. We need |
756 // to do this because this generic stub does not perform map checks. | 754 // to do this because this generic stub does not perform map checks. |
757 __ movzx_b(ebx, FieldOperand(edi, Map::kBitFieldOffset)); | 755 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), |
758 __ test(ebx, Immediate(1 << Map::kIsAccessCheckNeeded)); | 756 1 << Map::kIsAccessCheckNeeded); |
759 __ j(not_zero, &slow, not_taken); | 757 __ j(not_zero, &slow, not_taken); |
760 // Check that the key is a smi. | 758 // Check that the key is a smi. |
761 __ test(ecx, Immediate(kSmiTagMask)); | 759 __ test(ecx, Immediate(kSmiTagMask)); |
762 __ j(not_zero, &slow, not_taken); | 760 __ j(not_zero, &slow, not_taken); |
763 __ CmpInstanceType(edi, JS_ARRAY_TYPE); | 761 __ CmpInstanceType(edi, JS_ARRAY_TYPE); |
764 __ j(equal, &array); | 762 __ j(equal, &array); |
765 // Check that the object is some kind of JS object. | 763 // Check that the object is some kind of JS object. |
766 __ CmpInstanceType(edi, FIRST_JS_OBJECT_TYPE); | 764 __ CmpInstanceType(edi, FIRST_JS_OBJECT_TYPE); |
767 __ j(below, &slow, not_taken); | 765 __ j(below, &slow, not_taken); |
768 | 766 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 // ----------------------------------- | 863 // ----------------------------------- |
866 Label slow, check_heap_number; | 864 Label slow, check_heap_number; |
867 | 865 |
868 // Check that the object isn't a smi. | 866 // Check that the object isn't a smi. |
869 __ test(edx, Immediate(kSmiTagMask)); | 867 __ test(edx, Immediate(kSmiTagMask)); |
870 __ j(zero, &slow); | 868 __ j(zero, &slow); |
871 // Get the map from the receiver. | 869 // Get the map from the receiver. |
872 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); | 870 __ mov(edi, FieldOperand(edx, HeapObject::kMapOffset)); |
873 // Check that the receiver does not require access checks. We need | 871 // Check that the receiver does not require access checks. We need |
874 // to do this because this generic stub does not perform map checks. | 872 // to do this because this generic stub does not perform map checks. |
875 __ movzx_b(ebx, FieldOperand(edi, Map::kBitFieldOffset)); | 873 __ test_b(FieldOperand(edi, Map::kBitFieldOffset), |
876 __ test(ebx, Immediate(1 << Map::kIsAccessCheckNeeded)); | 874 1 << Map::kIsAccessCheckNeeded); |
877 __ j(not_zero, &slow); | 875 __ j(not_zero, &slow); |
878 // Check that the key is a smi. | 876 // Check that the key is a smi. |
879 __ test(ecx, Immediate(kSmiTagMask)); | 877 __ test(ecx, Immediate(kSmiTagMask)); |
880 __ j(not_zero, &slow); | 878 __ j(not_zero, &slow); |
881 // Get the instance type from the map of the receiver. | 879 // Get the instance type from the map of the receiver. |
882 __ CmpInstanceType(edi, JS_OBJECT_TYPE); | 880 __ CmpInstanceType(edi, JS_OBJECT_TYPE); |
883 __ j(not_equal, &slow); | 881 __ j(not_equal, &slow); |
884 | 882 |
885 // Check that the elements array is the appropriate type of | 883 // Check that the elements array is the appropriate type of |
886 // ExternalArray. | 884 // ExternalArray. |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 | 1170 |
1173 // Check for access to global object. | 1171 // Check for access to global object. |
1174 __ cmp(eax, JS_GLOBAL_OBJECT_TYPE); | 1172 __ cmp(eax, JS_GLOBAL_OBJECT_TYPE); |
1175 __ j(equal, &global_object); | 1173 __ j(equal, &global_object); |
1176 __ cmp(eax, JS_BUILTINS_OBJECT_TYPE); | 1174 __ cmp(eax, JS_BUILTINS_OBJECT_TYPE); |
1177 __ j(not_equal, &non_global_object); | 1175 __ j(not_equal, &non_global_object); |
1178 | 1176 |
1179 // Accessing global object: Load and invoke. | 1177 // Accessing global object: Load and invoke. |
1180 __ bind(&global_object); | 1178 __ bind(&global_object); |
1181 // Check that the global object does not require access checks. | 1179 // Check that the global object does not require access checks. |
1182 __ movzx_b(ebx, FieldOperand(ebx, Map::kBitFieldOffset)); | 1180 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), |
1183 __ test(ebx, Immediate(1 << Map::kIsAccessCheckNeeded)); | 1181 1 << Map::kIsAccessCheckNeeded); |
1184 __ j(not_equal, &miss, not_taken); | 1182 __ j(not_equal, &miss, not_taken); |
1185 GenerateNormalHelper(masm, argc, true, &miss); | 1183 GenerateNormalHelper(masm, argc, true, &miss); |
1186 | 1184 |
1187 // Accessing non-global object: Check for access to global proxy. | 1185 // Accessing non-global object: Check for access to global proxy. |
1188 Label global_proxy, invoke; | 1186 Label global_proxy, invoke; |
1189 __ bind(&non_global_object); | 1187 __ bind(&non_global_object); |
1190 __ cmp(eax, JS_GLOBAL_PROXY_TYPE); | 1188 __ cmp(eax, JS_GLOBAL_PROXY_TYPE); |
1191 __ j(equal, &global_proxy, not_taken); | 1189 __ j(equal, &global_proxy, not_taken); |
1192 // Check that the non-global, non-global-proxy object does not | 1190 // Check that the non-global, non-global-proxy object does not |
1193 // require access checks. | 1191 // require access checks. |
1194 __ movzx_b(ebx, FieldOperand(ebx, Map::kBitFieldOffset)); | 1192 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), |
1195 __ test(ebx, Immediate(1 << Map::kIsAccessCheckNeeded)); | 1193 1 << Map::kIsAccessCheckNeeded); |
1196 __ j(not_equal, &miss, not_taken); | 1194 __ j(not_equal, &miss, not_taken); |
1197 __ bind(&invoke); | 1195 __ bind(&invoke); |
1198 GenerateNormalHelper(masm, argc, false, &miss); | 1196 GenerateNormalHelper(masm, argc, false, &miss); |
1199 | 1197 |
1200 // Global object proxy access: Check access rights. | 1198 // Global object proxy access: Check access rights. |
1201 __ bind(&global_proxy); | 1199 __ bind(&global_proxy); |
1202 __ CheckAccessGlobalProxy(edx, eax, &miss); | 1200 __ CheckAccessGlobalProxy(edx, eax, &miss); |
1203 __ jmp(&invoke); | 1201 __ jmp(&invoke); |
1204 | 1202 |
1205 // Cache miss: Jump to runtime. | 1203 // Cache miss: Jump to runtime. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 __ j(less, &miss, not_taken); | 1299 __ j(less, &miss, not_taken); |
1302 | 1300 |
1303 // If this assert fails, we have to check upper bound too. | 1301 // If this assert fails, we have to check upper bound too. |
1304 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 1302 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
1305 | 1303 |
1306 // Check for access to global object (unlikely). | 1304 // Check for access to global object (unlikely). |
1307 __ cmp(edx, JS_GLOBAL_PROXY_TYPE); | 1305 __ cmp(edx, JS_GLOBAL_PROXY_TYPE); |
1308 __ j(equal, &global, not_taken); | 1306 __ j(equal, &global, not_taken); |
1309 | 1307 |
1310 // Check for non-global object that requires access check. | 1308 // Check for non-global object that requires access check. |
1311 __ movzx_b(ebx, FieldOperand(ebx, Map::kBitFieldOffset)); | 1309 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), |
1312 __ test(ebx, Immediate(1 << Map::kIsAccessCheckNeeded)); | 1310 1 << Map::kIsAccessCheckNeeded); |
1313 __ j(not_zero, &miss, not_taken); | 1311 __ j(not_zero, &miss, not_taken); |
1314 | 1312 |
1315 // Search the dictionary placing the result in eax. | 1313 // Search the dictionary placing the result in eax. |
1316 __ bind(&probe); | 1314 __ bind(&probe); |
1317 GenerateDictionaryLoad(masm, | 1315 GenerateDictionaryLoad(masm, |
1318 &miss, | 1316 &miss, |
1319 eax, | 1317 eax, |
1320 ecx, | 1318 ecx, |
1321 edx, | 1319 edx, |
1322 edi, | 1320 edi, |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); | 1615 ExternalReference ref = ExternalReference(IC_Utility(kKeyedStoreIC_Miss)); |
1618 __ TailCallExternalReference(ref, 3, 1); | 1616 __ TailCallExternalReference(ref, 3, 1); |
1619 } | 1617 } |
1620 | 1618 |
1621 #undef __ | 1619 #undef __ |
1622 | 1620 |
1623 | 1621 |
1624 } } // namespace v8::internal | 1622 } } // namespace v8::internal |
1625 | 1623 |
1626 #endif // V8_TARGET_ARCH_IA32 | 1624 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |