| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 __ push(descriptor->register_params_[i]); | 479 __ push(descriptor->register_params_[i]); |
| 480 } | 480 } |
| 481 ExternalReference miss = descriptor->miss_handler(); | 481 ExternalReference miss = descriptor->miss_handler(); |
| 482 __ CallExternalReference(miss, descriptor->register_param_count_); | 482 __ CallExternalReference(miss, descriptor->register_param_count_); |
| 483 } | 483 } |
| 484 | 484 |
| 485 __ Ret(); | 485 __ Ret(); |
| 486 } | 486 } |
| 487 | 487 |
| 488 | 488 |
| 489 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { | |
| 490 // Stack layout on entry: | |
| 491 // | |
| 492 // [sp]: function. | |
| 493 // [sp + kPointerSize]: serialized scope info | |
| 494 | |
| 495 // Try to allocate the context in new space. | |
| 496 Label gc; | |
| 497 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | |
| 498 __ Allocate(FixedArray::SizeFor(length), r0, r1, r2, &gc, TAG_OBJECT); | |
| 499 | |
| 500 // Load the function from the stack. | |
| 501 __ ldr(r3, MemOperand(sp, 0)); | |
| 502 | |
| 503 // Load the serialized scope info from the stack. | |
| 504 __ ldr(r1, MemOperand(sp, 1 * kPointerSize)); | |
| 505 | |
| 506 // Set up the object header. | |
| 507 __ LoadRoot(r2, Heap::kBlockContextMapRootIndex); | |
| 508 __ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset)); | |
| 509 __ mov(r2, Operand(Smi::FromInt(length))); | |
| 510 __ str(r2, FieldMemOperand(r0, FixedArray::kLengthOffset)); | |
| 511 | |
| 512 // If this block context is nested in the native context we get a smi | |
| 513 // sentinel instead of a function. The block context should get the | |
| 514 // canonical empty function of the native context as its closure which | |
| 515 // we still have to look up. | |
| 516 Label after_sentinel; | |
| 517 __ JumpIfNotSmi(r3, &after_sentinel); | |
| 518 if (FLAG_debug_code) { | |
| 519 __ cmp(r3, Operand::Zero()); | |
| 520 __ Assert(eq, kExpected0AsASmiSentinel); | |
| 521 } | |
| 522 __ ldr(r3, GlobalObjectOperand()); | |
| 523 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kNativeContextOffset)); | |
| 524 __ ldr(r3, ContextOperand(r3, Context::CLOSURE_INDEX)); | |
| 525 __ bind(&after_sentinel); | |
| 526 | |
| 527 // Set up the fixed slots, copy the global object from the previous context. | |
| 528 __ ldr(r2, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | |
| 529 __ str(r3, ContextOperand(r0, Context::CLOSURE_INDEX)); | |
| 530 __ str(cp, ContextOperand(r0, Context::PREVIOUS_INDEX)); | |
| 531 __ str(r1, ContextOperand(r0, Context::EXTENSION_INDEX)); | |
| 532 __ str(r2, ContextOperand(r0, Context::GLOBAL_OBJECT_INDEX)); | |
| 533 | |
| 534 // Initialize the rest of the slots to the hole value. | |
| 535 __ LoadRoot(r1, Heap::kTheHoleValueRootIndex); | |
| 536 for (int i = 0; i < slots_; i++) { | |
| 537 __ str(r1, ContextOperand(r0, i + Context::MIN_CONTEXT_SLOTS)); | |
| 538 } | |
| 539 | |
| 540 // Remove the on-stack argument and return. | |
| 541 __ mov(cp, r0); | |
| 542 __ add(sp, sp, Operand(2 * kPointerSize)); | |
| 543 __ Ret(); | |
| 544 | |
| 545 // Need to collect. Call into runtime system. | |
| 546 __ bind(&gc); | |
| 547 __ TailCallRuntime(Runtime::kPushBlockContext, 2, 1); | |
| 548 } | |
| 549 | |
| 550 | |
| 551 // Takes a Smi and converts to an IEEE 64 bit floating point value in two | 489 // Takes a Smi and converts to an IEEE 64 bit floating point value in two |
| 552 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and | 490 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and |
| 553 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a | 491 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a |
| 554 // scratch register. Destroys the source register. No GC occurs during this | 492 // scratch register. Destroys the source register. No GC occurs during this |
| 555 // stub so you don't have to set up the frame. | 493 // stub so you don't have to set up the frame. |
| 556 class ConvertToDoubleStub : public PlatformCodeStub { | 494 class ConvertToDoubleStub : public PlatformCodeStub { |
| 557 public: | 495 public: |
| 558 ConvertToDoubleStub(Register result_reg_1, | 496 ConvertToDoubleStub(Register result_reg_1, |
| 559 Register result_reg_2, | 497 Register result_reg_2, |
| 560 Register source_reg, | 498 Register source_reg, |
| (...skipping 5066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5627 restore_context ? | 5565 restore_context ? |
| 5628 &context_restore_operand : NULL); | 5566 &context_restore_operand : NULL); |
| 5629 } | 5567 } |
| 5630 | 5568 |
| 5631 | 5569 |
| 5632 #undef __ | 5570 #undef __ |
| 5633 | 5571 |
| 5634 } } // namespace v8::internal | 5572 } } // namespace v8::internal |
| 5635 | 5573 |
| 5636 #endif // V8_TARGET_ARCH_ARM | 5574 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |