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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 Isolate* isolate, | 43 Isolate* isolate, |
44 CodeStubInterfaceDescriptor* descriptor) { | 44 CodeStubInterfaceDescriptor* descriptor) { |
45 static Register registers[] = { a2 }; | 45 static Register registers[] = { a2 }; |
46 descriptor->register_param_count_ = 1; | 46 descriptor->register_param_count_ = 1; |
47 descriptor->register_params_ = registers; | 47 descriptor->register_params_ = registers; |
48 descriptor->deoptimization_handler_ = | 48 descriptor->deoptimization_handler_ = |
49 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry; | 49 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry; |
50 } | 50 } |
51 | 51 |
52 | 52 |
| 53 void FastNewContextStub::InitializeInterfaceDescriptor( |
| 54 Isolate* isolate, |
| 55 CodeStubInterfaceDescriptor* descriptor) { |
| 56 static Register registers[] = { a1 }; |
| 57 descriptor->register_param_count_ = 1; |
| 58 descriptor->register_params_ = registers; |
| 59 descriptor->deoptimization_handler_ = NULL; |
| 60 } |
| 61 |
| 62 |
53 void ToNumberStub::InitializeInterfaceDescriptor( | 63 void ToNumberStub::InitializeInterfaceDescriptor( |
54 Isolate* isolate, | 64 Isolate* isolate, |
55 CodeStubInterfaceDescriptor* descriptor) { | 65 CodeStubInterfaceDescriptor* descriptor) { |
56 static Register registers[] = { a0 }; | 66 static Register registers[] = { a0 }; |
57 descriptor->register_param_count_ = 1; | 67 descriptor->register_param_count_ = 1; |
58 descriptor->register_params_ = registers; | 68 descriptor->register_params_ = registers; |
59 descriptor->deoptimization_handler_ = NULL; | 69 descriptor->deoptimization_handler_ = NULL; |
60 } | 70 } |
61 | 71 |
62 | 72 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 __ push(descriptor->register_params_[i]); | 456 __ push(descriptor->register_params_[i]); |
447 } | 457 } |
448 ExternalReference miss = descriptor->miss_handler(); | 458 ExternalReference miss = descriptor->miss_handler(); |
449 __ CallExternalReference(miss, descriptor->register_param_count_); | 459 __ CallExternalReference(miss, descriptor->register_param_count_); |
450 } | 460 } |
451 | 461 |
452 __ Ret(); | 462 __ Ret(); |
453 } | 463 } |
454 | 464 |
455 | 465 |
456 void FastNewContextStub::Generate(MacroAssembler* masm) { | |
457 // Try to allocate the context in new space. | |
458 Label gc; | |
459 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | |
460 | |
461 // Attempt to allocate the context in new space. | |
462 __ Allocate(FixedArray::SizeFor(length), v0, a1, a2, &gc, TAG_OBJECT); | |
463 | |
464 // Load the function from the stack. | |
465 __ lw(a3, MemOperand(sp, 0)); | |
466 | |
467 // Set up the object header. | |
468 __ LoadRoot(a1, Heap::kFunctionContextMapRootIndex); | |
469 __ li(a2, Operand(Smi::FromInt(length))); | |
470 __ sw(a2, FieldMemOperand(v0, FixedArray::kLengthOffset)); | |
471 __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); | |
472 | |
473 // Set up the fixed slots, copy the global object from the previous context. | |
474 __ lw(a2, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
475 __ li(a1, Operand(Smi::FromInt(0))); | |
476 __ sw(a3, MemOperand(v0, Context::SlotOffset(Context::CLOSURE_INDEX))); | |
477 __ sw(cp, MemOperand(v0, Context::SlotOffset(Context::PREVIOUS_INDEX))); | |
478 __ sw(a1, MemOperand(v0, Context::SlotOffset(Context::EXTENSION_INDEX))); | |
479 __ sw(a2, MemOperand(v0, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
480 | |
481 // Initialize the rest of the slots to undefined. | |
482 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); | |
483 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { | |
484 __ sw(a1, MemOperand(v0, Context::SlotOffset(i))); | |
485 } | |
486 | |
487 // Remove the on-stack argument and return. | |
488 __ mov(cp, v0); | |
489 __ DropAndRet(1); | |
490 | |
491 // Need to collect. Call into runtime system. | |
492 __ bind(&gc); | |
493 __ TailCallRuntime(Runtime::kNewFunctionContext, 1, 1); | |
494 } | |
495 | |
496 | |
497 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { | 466 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { |
498 // Stack layout on entry: | 467 // Stack layout on entry: |
499 // | 468 // |
500 // [sp]: function. | 469 // [sp]: function. |
501 // [sp + kPointerSize]: serialized scope info | 470 // [sp + kPointerSize]: serialized scope info |
502 | 471 |
503 // Try to allocate the context in new space. | 472 // Try to allocate the context in new space. |
504 Label gc; | 473 Label gc; |
505 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 474 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
506 __ Allocate(FixedArray::SizeFor(length), v0, a1, a2, &gc, TAG_OBJECT); | 475 __ Allocate(FixedArray::SizeFor(length), v0, a1, a2, &gc, TAG_OBJECT); |
(...skipping 5200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5707 __ bind(&fast_elements_case); | 5676 __ bind(&fast_elements_case); |
5708 GenerateCase(masm, FAST_ELEMENTS); | 5677 GenerateCase(masm, FAST_ELEMENTS); |
5709 } | 5678 } |
5710 | 5679 |
5711 | 5680 |
5712 #undef __ | 5681 #undef __ |
5713 | 5682 |
5714 } } // namespace v8::internal | 5683 } } // namespace v8::internal |
5715 | 5684 |
5716 #endif // V8_TARGET_ARCH_MIPS | 5685 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |