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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 Register receiver, | 410 Register receiver, |
411 Register scratch1, | 411 Register scratch1, |
412 Register scratch2, | 412 Register scratch2, |
413 Label* miss_label) { | 413 Label* miss_label) { |
414 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 414 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
415 __ mov(r0, scratch1); | 415 __ mov(r0, scratch1); |
416 __ Ret(); | 416 __ Ret(); |
417 } | 417 } |
418 | 418 |
419 | 419 |
| 420 // Generate code to check that a global property cell is empty. Create |
| 421 // the property cell at compilation time if no cell exists for the |
| 422 // property. |
| 423 static void GenerateCheckPropertyCell(MacroAssembler* masm, |
| 424 Handle<GlobalObject> global, |
| 425 Handle<Name> name, |
| 426 Register scratch, |
| 427 Label* miss) { |
| 428 Handle<JSGlobalPropertyCell> cell = |
| 429 GlobalObject::EnsurePropertyCell(global, name); |
| 430 ASSERT(cell->value()->IsTheHole()); |
| 431 __ mov(scratch, Operand(cell)); |
| 432 __ ldr(scratch, |
| 433 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); |
| 434 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
| 435 __ cmp(scratch, ip); |
| 436 __ b(ne, miss); |
| 437 } |
| 438 |
| 439 |
420 // Generate StoreField code, value is passed in r0 register. | 440 // Generate StoreField code, value is passed in r0 register. |
421 // When leaving generated code after success, the receiver_reg and name_reg | 441 // When leaving generated code after success, the receiver_reg and name_reg |
422 // may be clobbered. Upon branch to miss_label, the receiver and name | 442 // may be clobbered. Upon branch to miss_label, the receiver and name |
423 // registers have their original values. | 443 // registers have their original values. |
424 void StubCompiler::GenerateStoreField(MacroAssembler* masm, | 444 void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
425 Handle<JSObject> object, | 445 Handle<JSObject> object, |
426 LookupResult* lookup, | 446 LookupResult* lookup, |
427 Handle<Map> transition, | 447 Handle<Map> transition, |
428 Handle<Name> name, | 448 Handle<Name> name, |
429 Register receiver_reg, | 449 Register receiver_reg, |
(...skipping 29 matching lines...) Expand all Loading... |
459 do { | 479 do { |
460 holder = JSObject::cast(holder->GetPrototype()); | 480 holder = JSObject::cast(holder->GetPrototype()); |
461 } while (holder->GetPrototype()->IsJSObject()); | 481 } while (holder->GetPrototype()->IsJSObject()); |
462 } | 482 } |
463 Register holder_reg = CheckPrototypes( | 483 Register holder_reg = CheckPrototypes( |
464 object, receiver_reg, Handle<JSObject>(holder), name_reg, | 484 object, receiver_reg, Handle<JSObject>(holder), name_reg, |
465 scratch1, scratch2, name, miss_restore_name); | 485 scratch1, scratch2, name, miss_restore_name); |
466 // If no property was found, and the holder (the last object in the | 486 // If no property was found, and the holder (the last object in the |
467 // prototype chain) is in slow mode, we need to do a negative lookup on the | 487 // prototype chain) is in slow mode, we need to do a negative lookup on the |
468 // holder. | 488 // holder. |
469 if (lookup->holder() == *object && | 489 if (lookup->holder() == *object) { |
470 !holder->HasFastProperties() && | 490 if (holder->IsJSGlobalObject()) { |
471 !holder->IsJSGlobalProxy() && | 491 GenerateCheckPropertyCell( |
472 !holder->IsJSGlobalObject()) { | 492 masm, |
473 GenerateDictionaryNegativeLookup( | 493 Handle<GlobalObject>(GlobalObject::cast(holder)), |
474 masm, miss_restore_name, holder_reg, name, scratch1, scratch2); | 494 name, |
| 495 scratch1, |
| 496 miss_restore_name); |
| 497 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { |
| 498 GenerateDictionaryNegativeLookup( |
| 499 masm, miss_restore_name, holder_reg, name, scratch1, scratch2); |
| 500 } |
475 } | 501 } |
476 } | 502 } |
477 | 503 |
478 // Stub never generated for non-global objects that require access | 504 // Stub never generated for non-global objects that require access |
479 // checks. | 505 // checks. |
480 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 506 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
481 | 507 |
482 // Perform map transition for the receiver if necessary. | 508 // Perform map transition for the receiver if necessary. |
483 if (!transition.is_null() && (object->map()->unused_property_fields() == 0)) { | 509 if (!transition.is_null() && (object->map()->unused_property_fields() == 0)) { |
484 // The properties must be extended before we can store the value. | 510 // The properties must be extended before we can store the value. |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 __ b(ne, interceptor_succeeded); | 945 __ b(ne, interceptor_succeeded); |
920 } | 946 } |
921 | 947 |
922 StubCompiler* stub_compiler_; | 948 StubCompiler* stub_compiler_; |
923 const ParameterCount& arguments_; | 949 const ParameterCount& arguments_; |
924 Register name_; | 950 Register name_; |
925 Code::ExtraICState extra_ic_state_; | 951 Code::ExtraICState extra_ic_state_; |
926 }; | 952 }; |
927 | 953 |
928 | 954 |
929 // Generate code to check that a global property cell is empty. Create | |
930 // the property cell at compilation time if no cell exists for the | |
931 // property. | |
932 static void GenerateCheckPropertyCell(MacroAssembler* masm, | |
933 Handle<GlobalObject> global, | |
934 Handle<Name> name, | |
935 Register scratch, | |
936 Label* miss) { | |
937 Handle<JSGlobalPropertyCell> cell = | |
938 GlobalObject::EnsurePropertyCell(global, name); | |
939 ASSERT(cell->value()->IsTheHole()); | |
940 __ mov(scratch, Operand(cell)); | |
941 __ ldr(scratch, | |
942 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); | |
943 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | |
944 __ cmp(scratch, ip); | |
945 __ b(ne, miss); | |
946 } | |
947 | |
948 | |
949 // Calls GenerateCheckPropertyCell for each global object in the prototype chain | 955 // Calls GenerateCheckPropertyCell for each global object in the prototype chain |
950 // from object to (but not including) holder. | 956 // from object to (but not including) holder. |
951 static void GenerateCheckPropertyCells(MacroAssembler* masm, | 957 static void GenerateCheckPropertyCells(MacroAssembler* masm, |
952 Handle<JSObject> object, | 958 Handle<JSObject> object, |
953 Handle<JSObject> holder, | 959 Handle<JSObject> holder, |
954 Handle<Name> name, | 960 Handle<Name> name, |
955 Register scratch, | 961 Register scratch, |
956 Label* miss) { | 962 Label* miss) { |
957 Handle<JSObject> current = object; | 963 Handle<JSObject> current = object; |
958 while (!current.is_identical_to(holder)) { | 964 while (!current.is_identical_to(holder)) { |
(...skipping 2889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3848 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); | 3854 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); |
3849 } | 3855 } |
3850 } | 3856 } |
3851 | 3857 |
3852 | 3858 |
3853 #undef __ | 3859 #undef __ |
3854 | 3860 |
3855 } } // namespace v8::internal | 3861 } } // namespace v8::internal |
3856 | 3862 |
3857 #endif // V8_TARGET_ARCH_ARM | 3863 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |