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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 Isolate* isolate, | 47 Isolate* isolate, |
48 CodeStubInterfaceDescriptor* descriptor) { | 48 CodeStubInterfaceDescriptor* descriptor) { |
49 static Register registers[] = { ebx }; | 49 static Register registers[] = { ebx }; |
50 descriptor->register_param_count_ = 1; | 50 descriptor->register_param_count_ = 1; |
51 descriptor->register_params_ = registers; | 51 descriptor->register_params_ = registers; |
52 descriptor->deoptimization_handler_ = | 52 descriptor->deoptimization_handler_ = |
53 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry; | 53 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry; |
54 } | 54 } |
55 | 55 |
56 | 56 |
| 57 void FastNewContextStub::InitializeInterfaceDescriptor( |
| 58 Isolate* isolate, |
| 59 CodeStubInterfaceDescriptor* descriptor) { |
| 60 static Register registers[] = { edi }; |
| 61 descriptor->register_param_count_ = 1; |
| 62 descriptor->register_params_ = registers; |
| 63 descriptor->deoptimization_handler_ = NULL; |
| 64 } |
| 65 |
| 66 |
57 void ToNumberStub::InitializeInterfaceDescriptor( | 67 void ToNumberStub::InitializeInterfaceDescriptor( |
58 Isolate* isolate, | 68 Isolate* isolate, |
59 CodeStubInterfaceDescriptor* descriptor) { | 69 CodeStubInterfaceDescriptor* descriptor) { |
60 static Register registers[] = { eax }; | 70 static Register registers[] = { eax }; |
61 descriptor->register_param_count_ = 1; | 71 descriptor->register_param_count_ = 1; |
62 descriptor->register_params_ = registers; | 72 descriptor->register_params_ = registers; |
63 descriptor->deoptimization_handler_ = NULL; | 73 descriptor->deoptimization_handler_ = NULL; |
64 } | 74 } |
65 | 75 |
66 | 76 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 __ push(descriptor->register_params_[i]); | 444 __ push(descriptor->register_params_[i]); |
435 } | 445 } |
436 ExternalReference miss = descriptor->miss_handler(); | 446 ExternalReference miss = descriptor->miss_handler(); |
437 __ CallExternalReference(miss, descriptor->register_param_count_); | 447 __ CallExternalReference(miss, descriptor->register_param_count_); |
438 } | 448 } |
439 | 449 |
440 __ ret(0); | 450 __ ret(0); |
441 } | 451 } |
442 | 452 |
443 | 453 |
444 void FastNewContextStub::Generate(MacroAssembler* masm) { | |
445 // Try to allocate the context in new space. | |
446 Label gc; | |
447 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | |
448 __ Allocate((length * kPointerSize) + FixedArray::kHeaderSize, | |
449 eax, ebx, ecx, &gc, TAG_OBJECT); | |
450 | |
451 // Get the function from the stack. | |
452 __ mov(ecx, Operand(esp, 1 * kPointerSize)); | |
453 | |
454 // Set up the object header. | |
455 Factory* factory = masm->isolate()->factory(); | |
456 __ mov(FieldOperand(eax, HeapObject::kMapOffset), | |
457 factory->function_context_map()); | |
458 __ mov(FieldOperand(eax, Context::kLengthOffset), | |
459 Immediate(Smi::FromInt(length))); | |
460 | |
461 // Set up the fixed slots. | |
462 __ Set(ebx, Immediate(0)); // Set to NULL. | |
463 __ mov(Operand(eax, Context::SlotOffset(Context::CLOSURE_INDEX)), ecx); | |
464 __ mov(Operand(eax, Context::SlotOffset(Context::PREVIOUS_INDEX)), esi); | |
465 __ mov(Operand(eax, Context::SlotOffset(Context::EXTENSION_INDEX)), ebx); | |
466 | |
467 // Copy the global object from the previous context. | |
468 __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
469 __ mov(Operand(eax, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)), ebx); | |
470 | |
471 // Initialize the rest of the slots to undefined. | |
472 __ mov(ebx, factory->undefined_value()); | |
473 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { | |
474 __ mov(Operand(eax, Context::SlotOffset(i)), ebx); | |
475 } | |
476 | |
477 // Return and remove the on-stack parameter. | |
478 __ mov(esi, eax); | |
479 __ ret(1 * kPointerSize); | |
480 | |
481 // Need to collect. Call into runtime system. | |
482 __ bind(&gc); | |
483 __ TailCallRuntime(Runtime::kNewFunctionContext, 1, 1); | |
484 } | |
485 | |
486 | |
487 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { | 454 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { |
488 // Stack layout on entry: | 455 // Stack layout on entry: |
489 // | 456 // |
490 // [esp + (1 * kPointerSize)]: function | 457 // [esp + (1 * kPointerSize)]: function |
491 // [esp + (2 * kPointerSize)]: serialized scope info | 458 // [esp + (2 * kPointerSize)]: serialized scope info |
492 | 459 |
493 // Try to allocate the context in new space. | 460 // Try to allocate the context in new space. |
494 Label gc; | 461 Label gc; |
495 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 462 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
496 __ Allocate(FixedArray::SizeFor(length), eax, ebx, ecx, &gc, TAG_OBJECT); | 463 __ Allocate(FixedArray::SizeFor(length), eax, ebx, ecx, &gc, TAG_OBJECT); |
(...skipping 4902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5399 __ bind(&fast_elements_case); | 5366 __ bind(&fast_elements_case); |
5400 GenerateCase(masm, FAST_ELEMENTS); | 5367 GenerateCase(masm, FAST_ELEMENTS); |
5401 } | 5368 } |
5402 | 5369 |
5403 | 5370 |
5404 #undef __ | 5371 #undef __ |
5405 | 5372 |
5406 } } // namespace v8::internal | 5373 } } // namespace v8::internal |
5407 | 5374 |
5408 #endif // V8_TARGET_ARCH_IA32 | 5375 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |