| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // ----------- S t a t e ------------- | 129 // ----------- S t a t e ------------- |
| 130 // -- r2 : name | 130 // -- r2 : name |
| 131 // -- lr : return address | 131 // -- lr : return address |
| 132 // -- [sp] : receiver | 132 // -- [sp] : receiver |
| 133 // ----------------------------------- | 133 // ----------------------------------- |
| 134 | 134 |
| 135 Label miss; | 135 Label miss; |
| 136 | 136 |
| 137 __ ldr(r0, MemOperand(sp, 0)); | 137 __ ldr(r0, MemOperand(sp, 0)); |
| 138 | 138 |
| 139 // Check that the receiver isn't a smi. | 139 StubCompiler::GenerateLoadArrayLength(masm, r0, r3, &miss); |
| 140 __ tst(r0, Operand(kSmiTagMask)); | |
| 141 __ b(eq, &miss); | |
| 142 | |
| 143 // Check that the object is a JS array. | |
| 144 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); | |
| 145 __ ldrb(r1, FieldMemOperand(r1, Map::kInstanceTypeOffset)); | |
| 146 __ cmp(r1, Operand(JS_ARRAY_TYPE)); | |
| 147 __ b(ne, &miss); | |
| 148 | |
| 149 // Load length directly from the JS array. | |
| 150 __ ldr(r0, FieldMemOperand(r0, JSArray::kLengthOffset)); | |
| 151 __ Ret(); | |
| 152 | |
| 153 // Cache miss: Jump to runtime. | |
| 154 __ bind(&miss); | 140 __ bind(&miss); |
| 155 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); | 141 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
| 156 __ Jump(ic, RelocInfo::CODE_TARGET); | |
| 157 } | 142 } |
| 158 | 143 |
| 159 | 144 |
| 160 // Generate code to check if an object is a string. If the object is | 145 // Generate code to check if an object is a string. If the object is |
| 161 // a string, the map's instance type is left in the scratch1 register. | 146 // a string, the map's instance type is left in the scratch1 register. |
| 162 static void GenerateStringCheck(MacroAssembler* masm, | 147 static void GenerateStringCheck(MacroAssembler* masm, |
| 163 Register receiver, | 148 Register receiver, |
| 164 Register scratch1, | 149 Register scratch1, |
| 165 Register scratch2, | 150 Register scratch2, |
| 166 Label* smi, | 151 Label* smi, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 178 __ b(ne, non_string_object); | 163 __ b(ne, non_string_object); |
| 179 } | 164 } |
| 180 | 165 |
| 181 | 166 |
| 182 void LoadIC::GenerateStringLength(MacroAssembler* masm) { | 167 void LoadIC::GenerateStringLength(MacroAssembler* masm) { |
| 183 // ----------- S t a t e ------------- | 168 // ----------- S t a t e ------------- |
| 184 // -- r2 : name | 169 // -- r2 : name |
| 185 // -- lr : return address | 170 // -- lr : return address |
| 186 // -- [sp] : receiver | 171 // -- [sp] : receiver |
| 187 // ----------------------------------- | 172 // ----------------------------------- |
| 188 | |
| 189 Label miss, load_length, check_wrapper; | 173 Label miss, load_length, check_wrapper; |
| 190 | 174 |
| 191 __ ldr(r0, MemOperand(sp, 0)); | 175 __ ldr(r0, MemOperand(sp, 0)); |
| 192 | 176 |
| 193 // Check if the object is a string leaving the instance type in the | 177 // Check if the object is a string leaving the instance type in the |
| 194 // r1 register. | 178 // r1 register. |
| 195 GenerateStringCheck(masm, r0, r1, r3, &miss, &check_wrapper); | 179 GenerateStringCheck(masm, r0, r1, r3, &miss, &check_wrapper); |
| 196 | 180 |
| 197 // Load length directly from the string. | 181 // Load length directly from the string. |
| 198 __ bind(&load_length); | 182 __ bind(&load_length); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 209 __ b(ne, &miss); | 193 __ b(ne, &miss); |
| 210 | 194 |
| 211 // Check if the wrapped value is a string and load the length | 195 // Check if the wrapped value is a string and load the length |
| 212 // directly if it is. | 196 // directly if it is. |
| 213 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset)); | 197 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset)); |
| 214 GenerateStringCheck(masm, r0, r1, r3, &miss, &miss); | 198 GenerateStringCheck(masm, r0, r1, r3, &miss, &miss); |
| 215 __ b(&load_length); | 199 __ b(&load_length); |
| 216 | 200 |
| 217 // Cache miss: Jump to runtime. | 201 // Cache miss: Jump to runtime. |
| 218 __ bind(&miss); | 202 __ bind(&miss); |
| 219 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Miss)); | 203 StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
| 220 __ Jump(ic, RelocInfo::CODE_TARGET); | |
| 221 } | 204 } |
| 222 | 205 |
| 223 | 206 |
| 224 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { | 207 void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { |
| 225 // ----------- S t a t e ------------- | 208 // ----------- S t a t e ------------- |
| 226 // -- r2 : name | 209 // -- r2 : name |
| 227 // -- lr : return address | 210 // -- lr : return address |
| 228 // -- [sp] : receiver | 211 // -- [sp] : receiver |
| 229 // ----------------------------------- | 212 // ----------------------------------- |
| 230 | 213 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } | 485 } |
| 503 | 486 |
| 504 | 487 |
| 505 void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { | 488 void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { |
| 506 // ----------- S t a t e ------------- | 489 // ----------- S t a t e ------------- |
| 507 // -- r2 : name | 490 // -- r2 : name |
| 508 // -- lr : return address | 491 // -- lr : return address |
| 509 // -- [sp] : receiver | 492 // -- [sp] : receiver |
| 510 // ----------------------------------- | 493 // ----------------------------------- |
| 511 | 494 |
| 512 __ ldr(r0, MemOperand(sp, 0)); | 495 __ ldr(r3, MemOperand(sp, 0)); |
| 513 __ push(r0); | 496 __ stm(db_w, sp, r2.bit() | r3.bit()); |
| 514 __ push(r2); | |
| 515 | 497 |
| 516 // Perform tail call to the entry. | 498 // Perform tail call to the entry. |
| 517 __ TailCallRuntime(f, 2); | 499 __ TailCallRuntime(f, 2); |
| 518 } | 500 } |
| 519 | 501 |
| 520 | 502 |
| 521 // TODO(1224671): ICs for keyed load/store is not implemented on ARM. | 503 // TODO(1224671): ICs for keyed load/store is not completed on ARM. |
| 504 Object* KeyedLoadIC_Miss(Arguments args); |
| 505 |
| 506 |
| 522 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 507 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
| 508 Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); |
| 523 } | 509 } |
| 524 | 510 |
| 511 |
| 525 void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { | 512 void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { |
| 513 // ---------- S t a t e -------------- |
| 514 // -- lr : return address |
| 515 // -- sp[0] : key |
| 516 // -- sp[4] : receiver |
| 517 __ ldm(ia, sp, r2.bit() | r3.bit()); |
| 518 __ stm(db_w, sp, r2.bit() | r3.bit()); |
| 519 |
| 520 __ TailCallRuntime(f, 2); |
| 526 } | 521 } |
| 527 | 522 |
| 523 |
| 524 // TODO(1224671): implement the fast case. |
| 528 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 525 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
| 526 // ---------- S t a t e -------------- |
| 527 // -- lr : return address |
| 528 // -- sp[0] : key |
| 529 // -- sp[4] : receiver |
| 530 |
| 531 KeyedLoadIC::Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); |
| 529 } | 532 } |
| 530 | 533 |
| 534 |
| 531 void KeyedStoreIC::Generate(MacroAssembler* masm, | 535 void KeyedStoreIC::Generate(MacroAssembler* masm, |
| 532 const ExternalReference& f) { | 536 const ExternalReference& f) { |
| 533 } | 537 // ---------- S t a t e -------------- |
| 538 // -- r0 : value |
| 539 // -- lr : return address |
| 540 // -- sp[0] : key |
| 541 // -- sp[1] : receiver |
| 534 | 542 |
| 535 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { | 543 __ ldm(ia, sp, r2.bit() | r3.bit()); |
| 536 } | 544 __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); |
| 537 | 545 |
| 538 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { | 546 __ TailCallRuntime(f, 3); |
| 539 } | 547 } |
| 540 | 548 |
| 541 | 549 |
| 550 // TODO(1224671): implement the fast case. |
| 551 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { |
| 552 // ---------- S t a t e -------------- |
| 553 // -- r0 : value |
| 554 // -- lr : return address |
| 555 // -- sp[0] : key |
| 556 // -- sp[1] : receiver |
| 557 |
| 558 KeyedStoreIC::Generate(masm, ExternalReference(Runtime::kSetProperty)); |
| 559 } |
| 560 |
| 561 |
| 562 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { |
| 563 // ---------- S t a t e -------------- |
| 564 // -- r0 : value |
| 565 // -- lr : return address |
| 566 // -- sp[0] : key |
| 567 // -- sp[1] : receiver |
| 568 // ----------- S t a t e ------------- |
| 569 |
| 570 __ ldm(ia, sp, r2.bit() | r3.bit()); |
| 571 __ stm(db_w, sp, r0.bit() | r2.bit() | r3.bit()); |
| 572 |
| 573 // Perform tail call to the entry. |
| 574 __ TailCallRuntime( |
| 575 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); |
| 576 } |
| 577 |
| 578 |
| 542 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 579 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
| 543 // ----------- S t a t e ------------- | 580 // ----------- S t a t e ------------- |
| 544 // -- r0 : value | 581 // -- r0 : value |
| 545 // -- r2 : name | 582 // -- r2 : name |
| 546 // -- lr : return address | 583 // -- lr : return address |
| 547 // -- [sp] : receiver | 584 // -- [sp] : receiver |
| 548 // ----------------------------------- | 585 // ----------------------------------- |
| 549 | 586 |
| 550 // Get the receiver from the stack and probe the stub cache. | 587 // Get the receiver from the stack and probe the stub cache. |
| 551 __ ldr(r1, MemOperand(sp)); | 588 __ ldr(r1, MemOperand(sp)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 624 |
| 588 // Perform tail call to the entry. | 625 // Perform tail call to the entry. |
| 589 __ TailCallRuntime(f, 3); | 626 __ TailCallRuntime(f, 3); |
| 590 } | 627 } |
| 591 | 628 |
| 592 | 629 |
| 593 #undef __ | 630 #undef __ |
| 594 | 631 |
| 595 | 632 |
| 596 } } // namespace v8::internal | 633 } } // namespace v8::internal |
| OLD | NEW |