| OLD | NEW |
| 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 void StubCompiler::GenerateStoreField(MacroAssembler* masm, | 370 void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
| 371 Handle<JSObject> object, | 371 Handle<JSObject> object, |
| 372 int index, | 372 int index, |
| 373 Handle<Map> transition, | 373 Handle<Map> transition, |
| 374 Register receiver_reg, | 374 Register receiver_reg, |
| 375 Register name_reg, | 375 Register name_reg, |
| 376 Register scratch, | 376 Register scratch, |
| 377 Label* miss_label) { | 377 Label* miss_label) { |
| 378 // a0 : value. | 378 // a0 : value. |
| 379 Label exit; | 379 Label exit; |
| 380 | 380 // Check that the map of the object hasn't changed. |
| 381 // Check that the receiver isn't a smi. | 381 __ CheckMap(receiver_reg, scratch, Handle<Map>(object->map()), miss_label, |
| 382 __ JumpIfSmi(receiver_reg, miss_label, scratch); | 382 DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); |
| 383 | |
| 384 // Check that the map of the receiver hasn't changed. | |
| 385 __ lw(scratch, FieldMemOperand(receiver_reg, HeapObject::kMapOffset)); | |
| 386 __ Branch(miss_label, ne, scratch, Operand(Handle<Map>(object->map()))); | |
| 387 | 383 |
| 388 // Perform global security token check if needed. | 384 // Perform global security token check if needed. |
| 389 if (object->IsJSGlobalProxy()) { | 385 if (object->IsJSGlobalProxy()) { |
| 390 __ CheckAccessGlobalProxy(receiver_reg, scratch, miss_label); | 386 __ CheckAccessGlobalProxy(receiver_reg, scratch, miss_label); |
| 391 } | 387 } |
| 392 | 388 |
| 393 // Stub never generated for non-global objects that require access | 389 // Stub never generated for non-global objects that require access |
| 394 // checks. | 390 // checks. |
| 395 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 391 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 396 | 392 |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 StringDictionary::kNotFound); | 1026 StringDictionary::kNotFound); |
| 1031 | 1027 |
| 1032 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, | 1028 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, |
| 1033 scratch1, scratch2); | 1029 scratch1, scratch2); |
| 1034 | 1030 |
| 1035 __ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); | 1031 __ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 1036 reg = holder_reg; // From now on the object will be in holder_reg. | 1032 reg = holder_reg; // From now on the object will be in holder_reg. |
| 1037 __ lw(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); | 1033 __ lw(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); |
| 1038 } else { | 1034 } else { |
| 1039 Handle<Map> current_map(current->map()); | 1035 Handle<Map> current_map(current->map()); |
| 1040 __ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); | 1036 __ CheckMap(reg, scratch1, current_map, miss, DONT_DO_SMI_CHECK, |
| 1041 // Branch on the result of the map check. | 1037 ALLOW_ELEMENT_TRANSITION_MAPS); |
| 1042 __ Branch(miss, ne, scratch1, Operand(current_map)); | |
| 1043 // Check access rights to the global object. This has to happen after | 1038 // Check access rights to the global object. This has to happen after |
| 1044 // the map check so that we know that the object is actually a global | 1039 // the map check so that we know that the object is actually a global |
| 1045 // object. | 1040 // object. |
| 1046 if (current->IsJSGlobalProxy()) { | 1041 if (current->IsJSGlobalProxy()) { |
| 1047 __ CheckAccessGlobalProxy(reg, scratch2, miss); | 1042 __ CheckAccessGlobalProxy(reg, scratch2, miss); |
| 1048 } | 1043 } |
| 1049 reg = holder_reg; // From now on the object will be in holder_reg. | 1044 reg = holder_reg; // From now on the object will be in holder_reg. |
| 1050 | 1045 |
| 1051 if (heap()->InNewSpace(*prototype)) { | 1046 if (heap()->InNewSpace(*prototype)) { |
| 1052 // The prototype is in new space; we cannot store a reference to it | 1047 // The prototype is in new space; we cannot store a reference to it |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1063 } | 1058 } |
| 1064 | 1059 |
| 1065 // Go to the next object in the prototype chain. | 1060 // Go to the next object in the prototype chain. |
| 1066 current = prototype; | 1061 current = prototype; |
| 1067 } | 1062 } |
| 1068 | 1063 |
| 1069 // Log the check depth. | 1064 // Log the check depth. |
| 1070 LOG(masm()->isolate(), IntEvent("check-maps-depth", depth + 1)); | 1065 LOG(masm()->isolate(), IntEvent("check-maps-depth", depth + 1)); |
| 1071 | 1066 |
| 1072 // Check the holder map. | 1067 // Check the holder map. |
| 1073 __ lw(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); | 1068 __ CheckMap(reg, scratch1, Handle<Map>(current->map()), miss, |
| 1074 __ Branch(miss, ne, scratch1, Operand(Handle<Map>(current->map()))); | 1069 DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); |
| 1075 | 1070 |
| 1076 // Perform security check for access to the global object. | 1071 // Perform security check for access to the global object. |
| 1077 ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded()); | 1072 ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded()); |
| 1078 if (holder->IsJSGlobalProxy()) { | 1073 if (holder->IsJSGlobalProxy()) { |
| 1079 __ CheckAccessGlobalProxy(reg, scratch1, miss); | 1074 __ CheckAccessGlobalProxy(reg, scratch1, miss); |
| 1080 } | 1075 } |
| 1081 | 1076 |
| 1082 // If we've skipped any global objects, it's not enough to verify that | 1077 // If we've skipped any global objects, it's not enough to verify that |
| 1083 // their maps haven't changed. We also need to check that the property | 1078 // their maps haven't changed. We also need to check that the property |
| 1084 // cell for the property is still empty. | 1079 // cell for the property is still empty. |
| (...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2486 Handle<AccessorInfo> callback, | 2481 Handle<AccessorInfo> callback, |
| 2487 Handle<String> name) { | 2482 Handle<String> name) { |
| 2488 // ----------- S t a t e ------------- | 2483 // ----------- S t a t e ------------- |
| 2489 // -- a0 : value | 2484 // -- a0 : value |
| 2490 // -- a1 : receiver | 2485 // -- a1 : receiver |
| 2491 // -- a2 : name | 2486 // -- a2 : name |
| 2492 // -- ra : return address | 2487 // -- ra : return address |
| 2493 // ----------------------------------- | 2488 // ----------------------------------- |
| 2494 Label miss; | 2489 Label miss; |
| 2495 | 2490 |
| 2496 // Check that the object isn't a smi. | |
| 2497 __ JumpIfSmi(a1, &miss); | |
| 2498 | |
| 2499 // Check that the map of the object hasn't changed. | 2491 // Check that the map of the object hasn't changed. |
| 2500 __ lw(a3, FieldMemOperand(a1, HeapObject::kMapOffset)); | 2492 __ CheckMap(a1, a3, Handle<Map>(object->map()), &miss, |
| 2501 __ Branch(&miss, ne, a3, Operand(Handle<Map>(object->map()))); | 2493 DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); |
| 2502 | 2494 |
| 2503 // Perform global security token check if needed. | 2495 // Perform global security token check if needed. |
| 2504 if (object->IsJSGlobalProxy()) { | 2496 if (object->IsJSGlobalProxy()) { |
| 2505 __ CheckAccessGlobalProxy(a1, a3, &miss); | 2497 __ CheckAccessGlobalProxy(a1, a3, &miss); |
| 2506 } | 2498 } |
| 2507 | 2499 |
| 2508 // Stub never generated for non-global objects that require access | 2500 // Stub never generated for non-global objects that require access |
| 2509 // checks. | 2501 // checks. |
| 2510 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 2502 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 2511 | 2503 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2533 Handle<JSObject> receiver, | 2525 Handle<JSObject> receiver, |
| 2534 Handle<String> name) { | 2526 Handle<String> name) { |
| 2535 // ----------- S t a t e ------------- | 2527 // ----------- S t a t e ------------- |
| 2536 // -- a0 : value | 2528 // -- a0 : value |
| 2537 // -- a1 : receiver | 2529 // -- a1 : receiver |
| 2538 // -- a2 : name | 2530 // -- a2 : name |
| 2539 // -- ra : return address | 2531 // -- ra : return address |
| 2540 // ----------------------------------- | 2532 // ----------------------------------- |
| 2541 Label miss; | 2533 Label miss; |
| 2542 | 2534 |
| 2543 // Check that the object isn't a smi. | |
| 2544 __ JumpIfSmi(a1, &miss); | |
| 2545 | |
| 2546 // Check that the map of the object hasn't changed. | 2535 // Check that the map of the object hasn't changed. |
| 2547 __ lw(a3, FieldMemOperand(a1, HeapObject::kMapOffset)); | 2536 __ CheckMap(a1, a3, Handle<Map>(receiver->map()), &miss, |
| 2548 __ Branch(&miss, ne, a3, Operand(Handle<Map>(receiver->map()))); | 2537 DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); |
| 2549 | 2538 |
| 2550 // Perform global security token check if needed. | 2539 // Perform global security token check if needed. |
| 2551 if (receiver->IsJSGlobalProxy()) { | 2540 if (receiver->IsJSGlobalProxy()) { |
| 2552 __ CheckAccessGlobalProxy(a1, a3, &miss); | 2541 __ CheckAccessGlobalProxy(a1, a3, &miss); |
| 2553 } | 2542 } |
| 2554 | 2543 |
| 2555 // Stub is never generated for non-global objects that require access | 2544 // Stub is never generated for non-global objects that require access |
| 2556 // checks. | 2545 // checks. |
| 2557 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded()); | 2546 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded()); |
| 2558 | 2547 |
| (...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4305 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); | 4294 Handle<Code> ic_miss = masm->isolate()->builtins()->KeyedStoreIC_Miss(); |
| 4306 __ Jump(ic_miss, RelocInfo::CODE_TARGET); | 4295 __ Jump(ic_miss, RelocInfo::CODE_TARGET); |
| 4307 } | 4296 } |
| 4308 | 4297 |
| 4309 | 4298 |
| 4310 #undef __ | 4299 #undef __ |
| 4311 | 4300 |
| 4312 } } // namespace v8::internal | 4301 } } // namespace v8::internal |
| 4313 | 4302 |
| 4314 #endif // V8_TARGET_ARCH_MIPS | 4303 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |