| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 // Get the receiver of the function from the stack into r1. | 310 // Get the receiver of the function from the stack into r1. |
| 311 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); | 311 __ ldr(r1, MemOperand(sp, argc * kPointerSize)); |
| 312 // Get the name of the function from the stack; 1 ~ receiver. | 312 // Get the name of the function from the stack; 1 ~ receiver. |
| 313 __ ldr(r2, MemOperand(sp, (argc + 1) * kPointerSize)); | 313 __ ldr(r2, MemOperand(sp, (argc + 1) * kPointerSize)); |
| 314 | 314 |
| 315 // Check that the receiver isn't a smi. | 315 // Check that the receiver isn't a smi. |
| 316 __ tst(r1, Operand(kSmiTagMask)); | 316 __ tst(r1, Operand(kSmiTagMask)); |
| 317 __ b(eq, &miss); | 317 __ b(eq, &miss); |
| 318 | 318 |
| 319 // Check that the receiver is a valid JS object. | 319 // Check that the receiver is a valid JS object. |
| 320 __ ldr(r0, FieldMemOperand(r1, HeapObject::kMapOffset)); | 320 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 321 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); | 321 __ ldrb(r0, FieldMemOperand(r3, Map::kInstanceTypeOffset)); |
| 322 __ cmp(r0, Operand(FIRST_JS_OBJECT_TYPE)); | 322 __ cmp(r0, Operand(FIRST_JS_OBJECT_TYPE)); |
| 323 __ b(lt, &miss); | 323 __ b(lt, &miss); |
| 324 | 324 |
| 325 // If this assert fails, we have to check upper bound too. | 325 // If this assert fails, we have to check upper bound too. |
| 326 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 326 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
| 327 | 327 |
| 328 // Check for access to global object. | 328 // Check for access to global object. |
| 329 __ cmp(r0, Operand(JS_GLOBAL_OBJECT_TYPE)); | 329 __ cmp(r0, Operand(JS_GLOBAL_OBJECT_TYPE)); |
| 330 __ b(eq, &global_object); | 330 __ b(eq, &global_object); |
| 331 __ cmp(r0, Operand(JS_BUILTINS_OBJECT_TYPE)); | 331 __ cmp(r0, Operand(JS_BUILTINS_OBJECT_TYPE)); |
| 332 __ b(ne, &non_global_object); | 332 __ b(ne, &non_global_object); |
| 333 | 333 |
| 334 // Accessing global object: Load and invoke. | 334 // Accessing global object: Load and invoke. |
| 335 __ bind(&global_object); | 335 __ bind(&global_object); |
| 336 // Check that the global object does not require access checks. |
| 337 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); |
| 338 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); |
| 339 __ b(ne, &miss); |
| 336 GenerateNormalHelper(masm, argc, true, &miss); | 340 GenerateNormalHelper(masm, argc, true, &miss); |
| 337 | 341 |
| 338 // Accessing non-global object: Check for access to global proxy. | 342 // Accessing non-global object: Check for access to global proxy. |
| 339 Label global_proxy, invoke; | 343 Label global_proxy, invoke; |
| 340 __ bind(&non_global_object); | 344 __ bind(&non_global_object); |
| 341 __ cmp(r0, Operand(JS_GLOBAL_PROXY_TYPE)); | 345 __ cmp(r0, Operand(JS_GLOBAL_PROXY_TYPE)); |
| 342 __ b(eq, &global_proxy); | 346 __ b(eq, &global_proxy); |
| 347 // Check that the non-global, non-global-proxy object does not |
| 348 // require access checks. |
| 349 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); |
| 350 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); |
| 351 __ b(ne, &miss); |
| 343 __ bind(&invoke); | 352 __ bind(&invoke); |
| 344 GenerateNormalHelper(masm, argc, false, &miss); | 353 GenerateNormalHelper(masm, argc, false, &miss); |
| 345 | 354 |
| 346 // Global object access: Check access rights. | 355 // Global object access: Check access rights. |
| 347 __ bind(&global_proxy); | 356 __ bind(&global_proxy); |
| 348 __ CheckAccessGlobalProxy(r1, r0, &miss); | 357 __ CheckAccessGlobalProxy(r1, r0, &miss); |
| 349 __ b(&invoke); | 358 __ b(&invoke); |
| 350 | 359 |
| 351 // Cache miss: Jump to runtime. | 360 // Cache miss: Jump to runtime. |
| 352 __ bind(&miss); | 361 __ bind(&miss); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 // ----------------------------------- | 443 // ----------------------------------- |
| 435 | 444 |
| 436 Label miss, probe, global; | 445 Label miss, probe, global; |
| 437 | 446 |
| 438 __ ldr(r0, MemOperand(sp, 0)); | 447 __ ldr(r0, MemOperand(sp, 0)); |
| 439 // Check that the receiver isn't a smi. | 448 // Check that the receiver isn't a smi. |
| 440 __ tst(r0, Operand(kSmiTagMask)); | 449 __ tst(r0, Operand(kSmiTagMask)); |
| 441 __ b(eq, &miss); | 450 __ b(eq, &miss); |
| 442 | 451 |
| 443 // Check that the receiver is a valid JS object. | 452 // Check that the receiver is a valid JS object. |
| 444 __ ldr(r1, FieldMemOperand(r0, HeapObject::kMapOffset)); | 453 __ ldr(r3, FieldMemOperand(r0, HeapObject::kMapOffset)); |
| 445 __ ldrb(r1, FieldMemOperand(r1, Map::kInstanceTypeOffset)); | 454 __ ldrb(r1, FieldMemOperand(r3, Map::kInstanceTypeOffset)); |
| 446 __ cmp(r1, Operand(FIRST_JS_OBJECT_TYPE)); | 455 __ cmp(r1, Operand(FIRST_JS_OBJECT_TYPE)); |
| 447 __ b(lt, &miss); | 456 __ b(lt, &miss); |
| 448 // If this assert fails, we have to check upper bound too. | 457 // If this assert fails, we have to check upper bound too. |
| 449 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 458 ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); |
| 450 | 459 |
| 451 // Check for access to global object (unlikely). | 460 // Check for access to global object (unlikely). |
| 452 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); | 461 __ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE)); |
| 453 __ b(eq, &global); | 462 __ b(eq, &global); |
| 454 | 463 |
| 464 // Check for non-global object that requires access check. |
| 465 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset)); |
| 466 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); |
| 467 __ b(ne, &miss); |
| 468 |
| 455 __ bind(&probe); | 469 __ bind(&probe); |
| 456 GenerateDictionaryLoad(masm, &miss, r1, r0); | 470 GenerateDictionaryLoad(masm, &miss, r1, r0); |
| 457 GenerateCheckNonFunctionOrLoaded(masm, &miss, r0, r1); | 471 GenerateCheckNonFunctionOrLoaded(masm, &miss, r0, r1); |
| 458 __ Ret(); | 472 __ Ret(); |
| 459 | 473 |
| 460 // Global object access: Check access rights. | 474 // Global object access: Check access rights. |
| 461 __ bind(&global); | 475 __ bind(&global); |
| 462 __ CheckAccessGlobalProxy(r0, r1, &miss); | 476 __ CheckAccessGlobalProxy(r0, r1, &miss); |
| 463 __ b(&probe); | 477 __ b(&probe); |
| 464 | 478 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // Get the key and receiver object from the stack. | 532 // Get the key and receiver object from the stack. |
| 519 __ ldm(ia, sp, r0.bit() | r1.bit()); | 533 __ ldm(ia, sp, r0.bit() | r1.bit()); |
| 520 // Check that the key is a smi. | 534 // Check that the key is a smi. |
| 521 __ tst(r0, Operand(kSmiTagMask)); | 535 __ tst(r0, Operand(kSmiTagMask)); |
| 522 __ b(ne, &slow); | 536 __ b(ne, &slow); |
| 523 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); | 537 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); |
| 524 // Check that the object isn't a smi. | 538 // Check that the object isn't a smi. |
| 525 __ tst(r1, Operand(kSmiTagMask)); | 539 __ tst(r1, Operand(kSmiTagMask)); |
| 526 __ b(eq, &slow); | 540 __ b(eq, &slow); |
| 527 | 541 |
| 542 // Get the map of the receiver. |
| 543 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 544 // Check that the receiver does not require access checks. We need |
| 545 // to check this explicitly since this generic stub does not perform |
| 546 // map checks. |
| 547 __ ldrb(r3, FieldMemOperand(r2, Map::kBitFieldOffset)); |
| 548 __ tst(r3, Operand(1 << Map::kIsAccessCheckNeeded)); |
| 549 __ b(ne, &slow); |
| 528 // Check that the object is some kind of JS object EXCEPT JS Value type. | 550 // 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, | 551 // In the case that the object is a value-wrapper object, |
| 530 // we enter the runtime system to make sure that indexing into string | 552 // we enter the runtime system to make sure that indexing into string |
| 531 // objects work as intended. | 553 // objects work as intended. |
| 532 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); | 554 ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
| 533 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | |
| 534 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 555 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
| 535 __ cmp(r2, Operand(JS_OBJECT_TYPE)); | 556 __ cmp(r2, Operand(JS_OBJECT_TYPE)); |
| 536 __ b(lt, &slow); | 557 __ b(lt, &slow); |
| 537 | 558 |
| 538 // Get the elements array of the object. | 559 // Get the elements array of the object. |
| 539 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); | 560 __ ldr(r1, FieldMemOperand(r1, JSObject::kElementsOffset)); |
| 540 // Check that the object is in fast mode (not dictionary). | 561 // Check that the object is in fast mode (not dictionary). |
| 541 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); | 562 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 542 __ cmp(r3, Operand(Factory::hash_table_map())); | 563 __ cmp(r3, Operand(Factory::hash_table_map())); |
| 543 __ b(eq, &slow); | 564 __ b(eq, &slow); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 // -- sp[1] : receiver | 611 // -- sp[1] : receiver |
| 591 Label slow, fast, array, extra, exit; | 612 Label slow, fast, array, extra, exit; |
| 592 // Get the key and the object from the stack. | 613 // Get the key and the object from the stack. |
| 593 __ ldm(ia, sp, r1.bit() | r3.bit()); // r1 = key, r3 = receiver | 614 __ ldm(ia, sp, r1.bit() | r3.bit()); // r1 = key, r3 = receiver |
| 594 // Check that the key is a smi. | 615 // Check that the key is a smi. |
| 595 __ tst(r1, Operand(kSmiTagMask)); | 616 __ tst(r1, Operand(kSmiTagMask)); |
| 596 __ b(ne, &slow); | 617 __ b(ne, &slow); |
| 597 // Check that the object isn't a smi. | 618 // Check that the object isn't a smi. |
| 598 __ tst(r3, Operand(kSmiTagMask)); | 619 __ tst(r3, Operand(kSmiTagMask)); |
| 599 __ b(eq, &slow); | 620 __ b(eq, &slow); |
| 600 // Get the type of the object from its map. | 621 // Get the map of the object. |
| 601 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); | 622 __ ldr(r2, FieldMemOperand(r3, HeapObject::kMapOffset)); |
| 623 // Check that the receiver does not require access checks. We need |
| 624 // to do this because this generic stub does not perform map checks. |
| 625 __ ldrb(ip, FieldMemOperand(r2, Map::kBitFieldOffset)); |
| 626 __ tst(ip, Operand(1 << Map::kIsAccessCheckNeeded)); |
| 627 __ b(ne, &slow); |
| 628 // Check if the object is a JS array or not. |
| 602 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); | 629 __ ldrb(r2, FieldMemOperand(r2, Map::kInstanceTypeOffset)); |
| 603 // Check if the object is a JS array or not. | |
| 604 __ cmp(r2, Operand(JS_ARRAY_TYPE)); | 630 __ cmp(r2, Operand(JS_ARRAY_TYPE)); |
| 605 // r1 == key. | 631 // r1 == key. |
| 606 __ b(eq, &array); | 632 __ b(eq, &array); |
| 607 // Check that the object is some kind of JS object. | 633 // Check that the object is some kind of JS object. |
| 608 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); | 634 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE)); |
| 609 __ b(lt, &slow); | 635 __ b(lt, &slow); |
| 610 | 636 |
| 611 | 637 |
| 612 // Object case: Check key against length in the elements array. | 638 // Object case: Check key against length in the elements array. |
| 613 __ ldr(r3, FieldMemOperand(r3, JSObject::kElementsOffset)); | 639 __ ldr(r3, FieldMemOperand(r3, JSObject::kElementsOffset)); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 | 784 |
| 759 // Perform tail call to the entry. | 785 // Perform tail call to the entry. |
| 760 __ TailCallRuntime(f, 3); | 786 __ TailCallRuntime(f, 3); |
| 761 } | 787 } |
| 762 | 788 |
| 763 | 789 |
| 764 #undef __ | 790 #undef __ |
| 765 | 791 |
| 766 | 792 |
| 767 } } // namespace v8::internal | 793 } } // namespace v8::internal |
| OLD | NEW |