| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 __ bind(&done); // t1 == t0 + 4*index | 118 __ bind(&done); // t1 == t0 + 4*index |
| 119 __ ldr(r3, FieldMemOperand(t1, kElementsStartOffset + 2 * kPointerSize)); | 119 __ ldr(r3, FieldMemOperand(t1, kElementsStartOffset + 2 * kPointerSize)); |
| 120 __ tst(r3, Operand(PropertyDetails::TypeField::mask() << kSmiTagSize)); | 120 __ tst(r3, Operand(PropertyDetails::TypeField::mask() << kSmiTagSize)); |
| 121 __ b(ne, miss); | 121 __ b(ne, miss); |
| 122 | 122 |
| 123 // Get the value at the masked, scaled index and return. | 123 // Get the value at the masked, scaled index and return. |
| 124 __ ldr(t1, FieldMemOperand(t1, kElementsStartOffset + 1 * kPointerSize)); | 124 __ ldr(t1, FieldMemOperand(t1, kElementsStartOffset + 1 * kPointerSize)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 | 127 |
| 128 // Helper function used to check that a value is either not a function |
| 129 // or is loaded if it is a function. |
| 130 static void GenerateCheckNonFunctionOrLoaded(MacroAssembler* masm, |
| 131 Label* miss, |
| 132 Register value, |
| 133 Register scratch) { |
| 134 Label done; |
| 135 // Check if the value is a Smi. |
| 136 __ tst(value, Operand(kSmiTagMask)); |
| 137 __ b(eq, &done); |
| 138 // Check if the value is a function. |
| 139 __ ldr(scratch, FieldMemOperand(value, HeapObject::kMapOffset)); |
| 140 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
| 141 __ cmp(scratch, Operand(JS_FUNCTION_TYPE)); |
| 142 __ b(ne, &done); |
| 143 // Check if the function has been loaded. |
| 144 __ ldr(scratch, |
| 145 FieldMemOperand(value, JSFunction::kSharedFunctionInfoOffset)); |
| 146 __ ldr(scratch, |
| 147 FieldMemOperand(scratch, SharedFunctionInfo::kLazyLoadDataOffset)); |
| 148 __ cmp(scratch, Operand(Factory::undefined_value())); |
| 149 __ b(ne, miss); |
| 150 __ bind(&done); |
| 151 } |
| 152 |
| 153 |
| 128 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { | 154 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
| 129 // ----------- S t a t e ------------- | 155 // ----------- S t a t e ------------- |
| 130 // -- r2 : name | 156 // -- r2 : name |
| 131 // -- lr : return address | 157 // -- lr : return address |
| 132 // -- [sp] : receiver | 158 // -- [sp] : receiver |
| 133 // ----------------------------------- | 159 // ----------------------------------- |
| 134 | 160 |
| 135 Label miss; | 161 Label miss; |
| 136 | 162 |
| 137 __ ldr(r0, MemOperand(sp, 0)); | 163 __ ldr(r0, MemOperand(sp, 0)); |
| 138 | 164 |
| 139 StubCompiler::GenerateLoadArrayLength(masm, r0, r3, &miss); | 165 StubCompiler::GenerateLoadArrayLength(masm, r0, r3, &miss); |
| 140 __ bind(&miss); | 166 __ bind(&miss); |
| 141 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); | 167 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
| 142 } | 168 } |
| 143 | 169 |
| 144 | 170 |
| 145 // Generate code to check if an object is a string. If the object is | |
| 146 // a string, the map's instance type is left in the scratch1 register. | |
| 147 static void GenerateStringCheck(MacroAssembler* masm, | |
| 148 Register receiver, | |
| 149 Register scratch1, | |
| 150 Register scratch2, | |
| 151 Label* smi, | |
| 152 Label* non_string_object) { | |
| 153 // Check that the receiver isn't a smi. | |
| 154 __ tst(receiver, Operand(kSmiTagMask)); | |
| 155 __ b(eq, smi); | |
| 156 | |
| 157 // Check that the object is a string. | |
| 158 __ ldr(scratch1, FieldMemOperand(receiver, HeapObject::kMapOffset)); | |
| 159 __ ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); | |
| 160 __ and_(scratch2, scratch1, Operand(kIsNotStringMask)); | |
| 161 // The cast is to resolve the overload for the argument of 0x0. | |
| 162 __ cmp(scratch2, Operand(static_cast<int32_t>(kStringTag))); | |
| 163 __ b(ne, non_string_object); | |
| 164 } | |
| 165 | |
| 166 | |
| 167 void LoadIC::GenerateStringLength(MacroAssembler* masm) { | 171 void LoadIC::GenerateStringLength(MacroAssembler* masm) { |
| 168 // ----------- S t a t e ------------- | 172 // ----------- S t a t e ------------- |
| 169 // -- r2 : name | 173 // -- r2 : name |
| 170 // -- lr : return address | 174 // -- lr : return address |
| 171 // -- [sp] : receiver | 175 // -- [sp] : receiver |
| 172 // ----------------------------------- | 176 // ----------------------------------- |
| 173 Label miss, load_length, check_wrapper; | 177 Label miss; |
| 174 | 178 |
| 175 __ ldr(r0, MemOperand(sp, 0)); | 179 __ ldr(r0, MemOperand(sp, 0)); |
| 176 | 180 |
| 177 // Check if the object is a string leaving the instance type in the | 181 StubCompiler::GenerateLoadStringLength2(masm, r0, r1, r3, &miss); |
| 178 // r1 register. | |
| 179 GenerateStringCheck(masm, r0, r1, r3, &miss, &check_wrapper); | |
| 180 | |
| 181 // Load length directly from the string. | |
| 182 __ bind(&load_length); | |
| 183 __ and_(r1, r1, Operand(kStringSizeMask)); | |
| 184 __ add(r1, r1, Operand(String::kHashShift)); | |
| 185 __ ldr(r0, FieldMemOperand(r0, String::kLengthOffset)); | |
| 186 __ mov(r0, Operand(r0, LSR, r1)); | |
| 187 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | |
| 188 __ Ret(); | |
| 189 | |
| 190 // Check if the object is a JSValue wrapper. | |
| 191 __ bind(&check_wrapper); | |
| 192 __ cmp(r1, Operand(JS_VALUE_TYPE)); | |
| 193 __ b(ne, &miss); | |
| 194 | |
| 195 // Check if the wrapped value is a string and load the length | |
| 196 // directly if it is. | |
| 197 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset)); | |
| 198 GenerateStringCheck(masm, r0, r1, r3, &miss, &miss); | |
| 199 __ b(&load_length); | |
| 200 | |
| 201 // Cache miss: Jump to runtime. | 182 // Cache miss: Jump to runtime. |
| 202 __ bind(&miss); | 183 __ bind(&miss); |
| 203 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); | 184 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
| 204 } | 185 } |
| 205 | 186 |
| 206 | 187 |
| 207 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { | 188 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { |
| 208 // ----------- S t a t e ------------- | 189 // ----------- S t a t e ------------- |
| 209 // -- r2 : name | 190 // -- r2 : name |
| 210 // -- lr : return address | 191 // -- lr : return address |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // Check that the value isn't a smi. | 274 // Check that the value isn't a smi. |
| 294 __ tst(r1, Operand(kSmiTagMask)); | 275 __ tst(r1, Operand(kSmiTagMask)); |
| 295 __ b(eq, miss); | 276 __ b(eq, miss); |
| 296 | 277 |
| 297 // Check that the value is a JSFunction. | 278 // Check that the value is a JSFunction. |
| 298 __ ldr(r0, FieldMemOperand(r1, HeapObject::kMapOffset)); | 279 __ ldr(r0, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 299 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 280 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); |
| 300 __ cmp(r0, Operand(JS_FUNCTION_TYPE)); | 281 __ cmp(r0, Operand(JS_FUNCTION_TYPE)); |
| 301 __ b(ne, miss); | 282 __ b(ne, miss); |
| 302 | 283 |
| 284 // Check that the function has been loaded. |
| 285 __ ldr(r0, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 286 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kLazyLoadDataOffset)); |
| 287 __ cmp(r0, Operand(Factory::undefined_value())); |
| 288 __ b(ne, miss); |
| 289 |
| 303 // Patch the receiver with the global proxy if necessary. | 290 // Patch the receiver with the global proxy if necessary. |
| 304 if (is_global_object) { | 291 if (is_global_object) { |
| 305 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); | 292 __ ldr(r2, MemOperand(sp, argc * kPointerSize)); |
| 306 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); | 293 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); |
| 307 __ str(r2, MemOperand(sp, argc * kPointerSize)); | 294 __ str(r2, MemOperand(sp, argc * kPointerSize)); |
| 308 } | 295 } |
| 309 | 296 |
| 310 // Invoke the function. | 297 // Invoke the function. |
| 311 ParameterCount actual(argc); | 298 ParameterCount actual(argc); |
| 312 __ InvokeFunction(r1, actual, JUMP_FUNCTION); | 299 __ InvokeFunction(r1, actual, JUMP_FUNCTION); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 __ b(lt, &miss); | 447 __ b(lt, &miss); |
| 461 // If this assert fails, we have to check upper bound too. | 448 // If this assert fails, we have to check upper bound too. |
| 462 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 449 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
| 463 | 450 |
| 464 // Check for access to global object (unlikely). | 451 // Check for access to global object (unlikely). |
| 465 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); | 452 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); |
| 466 __ b(eq, &global); | 453 __ b(eq, &global); |
| 467 | 454 |
| 468 __ bind(&probe); | 455 __ bind(&probe); |
| 469 GenerateDictionaryLoad(masm, &miss, r1, r0); | 456 GenerateDictionaryLoad(masm, &miss, r1, r0); |
| 457 GenerateCheckNonFunctionOrLoaded(masm, &miss, r0, r1); |
| 470 __ Ret(); | 458 __ Ret(); |
| 471 | 459 |
| 472 // Global object access: Check access rights. | 460 // Global object access: Check access rights. |
| 473 __ bind(&global); | 461 __ bind(&global); |
| 474 __ CheckAccessGlobalProxy(r0, r1, &miss); | 462 __ CheckAccessGlobalProxy(r0, r1, &miss); |
| 475 __ b(&probe); | 463 __ b(&probe); |
| 476 | 464 |
| 477 // Cache miss: Restore receiver from stack and jump to runtime. | 465 // Cache miss: Restore receiver from stack and jump to runtime. |
| 478 __ bind(&miss); | 466 __ bind(&miss); |
| 479 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); | 467 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 493 // ----------------------------------- | 481 // ----------------------------------- |
| 494 | 482 |
| 495 __ ldr(r3, MemOperand(sp, 0)); | 483 __ ldr(r3, MemOperand(sp, 0)); |
| 496 __ stm(db_w, sp, r2.bit() | r3.bit()); | 484 __ stm(db_w, sp, r2.bit() | r3.bit()); |
| 497 | 485 |
| 498 // Perform tail call to the entry. | 486 // Perform tail call to the entry. |
| 499 __ TailCallRuntime(f, 2); | 487 __ TailCallRuntime(f, 2); |
| 500 } | 488 } |
| 501 | 489 |
| 502 | 490 |
| 503 // TODO(1224671): ICs for keyed load/store is not completed on ARM. | |
| 504 Object* KeyedLoadIC_Miss(Arguments args); | 491 Object* KeyedLoadIC_Miss(Arguments args); |
| 505 | 492 |
| 506 | 493 |
| 507 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 494 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| 508 Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); | 495 Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); |
| 509 } | 496 } |
| 510 | 497 |
| 511 | 498 |
| 512 void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { | 499 void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { |
| 513 // ---------- S t a t e -------------- | 500 // ---------- S t a t e -------------- |
| 514 // -- lr : return address | 501 // -- lr : return address |
| 515 // -- sp[0] : key | 502 // -- sp[0] : key |
| 516 // -- sp[4] : receiver | 503 // -- sp[4] : receiver |
| 517 __ ldm(ia, sp, r2.bit() | r3.bit()); | 504 __ ldm(ia, sp, r2.bit() | r3.bit()); |
| 518 __ stm(db_w, sp, r2.bit() | r3.bit()); | 505 __ stm(db_w, sp, r2.bit() | r3.bit()); |
| 519 | 506 |
| 520 __ TailCallRuntime(f, 2); | 507 __ TailCallRuntime(f, 2); |
| 521 } | 508 } |
| 522 | 509 |
| 523 | 510 |
| 524 // TODO(1224671): implement the fast case. | |
| 525 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 511 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
| 526 // ---------- S t a t e -------------- | 512 // ---------- S t a t e -------------- |
| 527 // -- lr : return address | 513 // -- lr : return address |
| 528 // -- sp[0] : key | 514 // -- sp[0] : key |
| 529 // -- sp[4] : receiver | 515 // -- sp[4] : receiver |
| 516 Label slow, fast; |
| 530 | 517 |
| 531 KeyedLoadIC::Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); | 518 // Get the key and receiver object from the stack. |
| 519 __ ldm(ia, sp, r0.bit() | r1.bit()); |
| 520 // Check that the key is a smi. |
| 521 __ tst(r0, Operand(kSmiTagMask)); |
| 522 __ b(ne, &slow); |
| 523 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); |
| 524 // Check that the object isn't a smi. |
| 525 __ tst(r1, Operand(kSmiTagMask)); |
| 526 __ b(eq, &slow); |
| 527 |
| 528 // Check that the object is some kind of JS object EXCEPT JS Value type. |
| 529 // In the case that the object is a value-wrapper object, |
| 530 // we enter the runtime system to make sure that indexing into string |
| 531 // objects work as intended. |
| 532 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
| 533 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 534 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
| 535 __ cmp(r2, Operand(JS_OBJECT_TYPE)); |
| 536 __ b(lt, &slow); |
| 537 |
| 538 // Get the elements array of the object. |
| 539 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); |
| 540 // Check that the object is in fast mode (not dictionary). |
| 541 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 542 __ cmp(r3, Operand(Factory::hash_table_map())); |
| 543 __ b(eq, &slow); |
| 544 // Check that the key (index) is within bounds. |
| 545 __ ldr(r3, FieldMemOperand(r1, Array::kLengthOffset)); |
| 546 __ cmp(r0, Operand(r3)); |
| 547 __ b(lo, &fast); |
| 548 |
| 549 // Slow case: Push extra copies of the arguments (2). |
| 550 __ bind(&slow); |
| 551 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1, r0, r1); |
| 552 __ ldm(ia, sp, r0.bit() | r1.bit()); |
| 553 __ stm(db_w, sp, r0.bit() | r1.bit()); |
| 554 // Do tail-call to runtime routine. |
| 555 __ TailCallRuntime(ExternalReference(Runtime::kGetProperty), 2); |
| 556 |
| 557 // Fast case: Do the load. |
| 558 __ bind(&fast); |
| 559 __ add(r3, r1, Operand(Array::kHeaderSize - kHeapObjectTag)); |
| 560 __ ldr(r0, MemOperand(r3, r0, LSL, kPointerSizeLog2)); |
| 561 __ cmp(r0, Operand(Factory::the_hole_value())); |
| 562 // In case the loaded value is the_hole we have to consult GetProperty |
| 563 // to ensure the prototype chain is searched. |
| 564 __ b(eq, &slow); |
| 565 |
| 566 __ Ret(); |
| 532 } | 567 } |
| 533 | 568 |
| 534 | 569 |
| 535 void KeyedStoreIC::Generate(MacroAssembler* masm, | 570 void KeyedStoreIC::Generate(MacroAssembler* masm, |
| 536 const ExternalReference& f) { | 571 const ExternalReference& f) { |
| 537 // ---------- S t a t e -------------- | 572 // ---------- S t a t e -------------- |
| 538 // -- r0 : value | 573 // -- r0 : value |
| 539 // -- lr : return address | 574 // -- lr : return address |
| 540 // -- sp[0] : key | 575 // -- sp[0] : key |
| 541 // -- sp[1] : receiver | 576 // -- sp[1] : receiver |
| 542 | 577 |
| 543 __ ldm(ia, sp, r2.bit() | r3.bit()); | 578 __ ldm(ia, sp, r2.bit() | r3.bit()); |
| 544 __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); | 579 __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); |
| 545 | 580 |
| 546 __ TailCallRuntime(f, 3); | 581 __ TailCallRuntime(f, 3); |
| 547 } | 582 } |
| 548 | 583 |
| 549 | 584 |
| 550 // TODO(1224671): implement the fast case. | |
| 551 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 585 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
| 552 // ---------- S t a t e -------------- | 586 // ---------- S t a t e -------------- |
| 553 // -- r0 : value | 587 // -- r0 : value |
| 554 // -- lr : return address | 588 // -- lr : return address |
| 555 // -- sp[0] : key | 589 // -- sp[0] : key |
| 556 // -- sp[1] : receiver | 590 // -- sp[1] : receiver |
| 591 Label slow, fast, array, extra, exit; |
| 592 // Get the key and the object from the stack. |
| 593 __ ldm(ia, sp, r1.bit() | r3.bit()); // r1 = key, r3 = receiver |
| 594 // Check that the key is a smi. |
| 595 __ tst(r1, Operand(kSmiTagMask)); |
| 596 __ b(ne, &slow); |
| 597 // Check that the object isn't a smi. |
| 598 __ tst(r3, Operand(kSmiTagMask)); |
| 599 __ b(eq, &slow); |
| 600 // Get the type of the object from its map. |
| 601 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
| 602 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
| 603 // Check if the object is a JS array or not. |
| 604 __ cmp(r2, Operand(JS_ARRAY_TYPE)); |
| 605 // r1 == key. |
| 606 __ b(eq, &array); |
| 607 // Check that the object is some kind of JS object. |
| 608 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); |
| 609 __ b(lt, &slow); |
| 557 | 610 |
| 558 KeyedStoreIC::Generate(masm, ExternalReference(Runtime::kSetProperty)); | 611 |
| 612 // Object case: Check key against length in the elements array. |
| 613 __ ldr(r3, FieldMemOperand(r3, JSObject::kElementsOffset)); |
| 614 // Check that the object is in fast mode (not dictionary). |
| 615 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
| 616 __ cmp(r2, Operand(Factory::hash_table_map())); |
| 617 __ b(eq, &slow); |
| 618 // Untag the key (for checking against untagged length in the fixed array). |
| 619 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); |
| 620 // Compute address to store into and check array bounds. |
| 621 __ add(r2, r3, Operand(Array::kHeaderSize - kHeapObjectTag)); |
| 622 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); |
| 623 __ ldr(ip, FieldMemOperand(r3, Array::kLengthOffset)); |
| 624 __ cmp(r1, Operand(ip)); |
| 625 __ b(lo, &fast); |
| 626 |
| 627 |
| 628 // Slow case: Push extra copies of the arguments (3). |
| 629 __ bind(&slow); |
| 630 __ ldm(ia, sp, r1.bit() | r3.bit()); // r0 == value, r1 == key, r3 == object |
| 631 __ stm(db_w, sp, r0.bit() | r1.bit() | r3.bit()); |
| 632 // Do tail-call to runtime routine. |
| 633 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3); |
| 634 |
| 635 // Extra capacity case: Check if there is extra capacity to |
| 636 // perform the store and update the length. Used for adding one |
| 637 // element to the array by writing to array[array.length]. |
| 638 // r0 == value, r1 == key, r2 == elements, r3 == object |
| 639 __ bind(&extra); |
| 640 __ b(ne, &slow); // do not leave holes in the array |
| 641 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); // untag |
| 642 __ ldr(ip, FieldMemOperand(r2, Array::kLengthOffset)); |
| 643 __ cmp(r1, Operand(ip)); |
| 644 __ b(hs, &slow); |
| 645 __ mov(r1, Operand(r1, LSL, kSmiTagSize)); // restore tag |
| 646 __ add(r1, r1, Operand(1 << kSmiTagSize)); // and increment |
| 647 __ str(r1, FieldMemOperand(r3, JSArray::kLengthOffset)); |
| 648 __ mov(r3, Operand(r2)); |
| 649 // NOTE: Computing the address to store into must take the fact |
| 650 // that the key has been incremented into account. |
| 651 int displacement = Array::kHeaderSize - kHeapObjectTag - |
| 652 ((1 << kSmiTagSize) * 2); |
| 653 __ add(r2, r2, Operand(displacement)); |
| 654 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 655 __ b(&fast); |
| 656 |
| 657 |
| 658 // Array case: Get the length and the elements array from the JS |
| 659 // array. Check that the array is in fast mode; if it is the |
| 660 // length is always a smi. |
| 661 // r0 == value, r3 == object |
| 662 __ bind(&array); |
| 663 __ ldr(r2, FieldMemOperand(r3, JSObject::kElementsOffset)); |
| 664 __ ldr(r1, FieldMemOperand(r2, HeapObject::kMapOffset)); |
| 665 __ cmp(r1, Operand(Factory::hash_table_map())); |
| 666 __ b(eq, &slow); |
| 667 |
| 668 // Check the key against the length in the array, compute the |
| 669 // address to store into and fall through to fast case. |
| 670 __ ldr(r1, MemOperand(sp)); // resotre key |
| 671 // r0 == value, r1 == key, r2 == elements, r3 == object. |
| 672 __ ldr(ip, FieldMemOperand(r3, JSArray::kLengthOffset)); |
| 673 __ cmp(r1, Operand(ip)); |
| 674 __ b(hs, &extra); |
| 675 __ mov(r3, Operand(r2)); |
| 676 __ add(r2, r2, Operand(Array::kHeaderSize - kHeapObjectTag)); |
| 677 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2 - kSmiTagSize)); |
| 678 |
| 679 |
| 680 // Fast case: Do the store. |
| 681 // r0 == value, r2 == address to store into, r3 == elements |
| 682 __ bind(&fast); |
| 683 __ str(r0, MemOperand(r2)); |
| 684 // Skip write barrier if the written value is a smi. |
| 685 __ tst(r0, Operand(kSmiTagMask)); |
| 686 __ b(eq, &exit); |
| 687 // Update write barrier for the elements array address. |
| 688 __ sub(r1, r2, Operand(r3)); |
| 689 __ RecordWrite(r3, r1, r2); |
| 690 |
| 691 __ bind(&exit); |
| 692 __ Ret(); |
| 559 } | 693 } |
| 560 | 694 |
| 561 | 695 |
| 562 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { | 696 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { |
| 563 // ---------- S t a t e -------------- | 697 // ---------- S t a t e -------------- |
| 564 // -- r0 : value | 698 // -- r0 : value |
| 565 // -- lr : return address | 699 // -- lr : return address |
| 566 // -- sp[0] : key | 700 // -- sp[0] : key |
| 567 // -- sp[1] : receiver | 701 // -- sp[1] : receiver |
| 568 // ----------- S t a t e ------------- | 702 // ----------- S t a t e ------------- |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 | 758 |
| 625 // Perform tail call to the entry. | 759 // Perform tail call to the entry. |
| 626 __ TailCallRuntime(f, 3); | 760 __ TailCallRuntime(f, 3); |
| 627 } | 761 } |
| 628 | 762 |
| 629 | 763 |
| 630 #undef __ | 764 #undef __ |
| 631 | 765 |
| 632 | 766 |
| 633 } } // namespace v8::internal | 767 } } // namespace v8::internal |
| OLD | NEW |