| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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[] = { rbx }; | 45 static Register registers[] = { rbx }; |
| 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[] = { rdi }; |
| 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[] = { rax }; | 66 static Register registers[] = { rax }; |
| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 __ push(descriptor->register_params_[i]); | 441 __ push(descriptor->register_params_[i]); |
| 432 } | 442 } |
| 433 ExternalReference miss = descriptor->miss_handler(); | 443 ExternalReference miss = descriptor->miss_handler(); |
| 434 __ CallExternalReference(miss, descriptor->register_param_count_); | 444 __ CallExternalReference(miss, descriptor->register_param_count_); |
| 435 } | 445 } |
| 436 | 446 |
| 437 __ Ret(); | 447 __ Ret(); |
| 438 } | 448 } |
| 439 | 449 |
| 440 | 450 |
| 441 void FastNewContextStub::Generate(MacroAssembler* masm) { | |
| 442 // Try to allocate the context in new space. | |
| 443 Label gc; | |
| 444 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | |
| 445 __ Allocate((length * kPointerSize) + FixedArray::kHeaderSize, | |
| 446 rax, rbx, rcx, &gc, TAG_OBJECT); | |
| 447 | |
| 448 // Get the function from the stack. | |
| 449 StackArgumentsAccessor args(rsp, 1, ARGUMENTS_DONT_CONTAIN_RECEIVER); | |
| 450 __ movp(rcx, args.GetArgumentOperand(0)); | |
| 451 | |
| 452 // Set up the object header. | |
| 453 __ LoadRoot(kScratchRegister, Heap::kFunctionContextMapRootIndex); | |
| 454 __ movp(FieldOperand(rax, HeapObject::kMapOffset), kScratchRegister); | |
| 455 __ Move(FieldOperand(rax, FixedArray::kLengthOffset), Smi::FromInt(length)); | |
| 456 | |
| 457 // Set up the fixed slots. | |
| 458 __ Set(rbx, 0); // Set to NULL. | |
| 459 __ movp(Operand(rax, Context::SlotOffset(Context::CLOSURE_INDEX)), rcx); | |
| 460 __ movp(Operand(rax, Context::SlotOffset(Context::PREVIOUS_INDEX)), rsi); | |
| 461 __ movp(Operand(rax, Context::SlotOffset(Context::EXTENSION_INDEX)), rbx); | |
| 462 | |
| 463 // Copy the global object from the previous context. | |
| 464 __ movp(rbx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
| 465 __ movp(Operand(rax, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)), rbx); | |
| 466 | |
| 467 // Initialize the rest of the slots to undefined. | |
| 468 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex); | |
| 469 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; i++) { | |
| 470 __ movp(Operand(rax, Context::SlotOffset(i)), rbx); | |
| 471 } | |
| 472 | |
| 473 // Return and remove the on-stack parameter. | |
| 474 __ movp(rsi, rax); | |
| 475 __ ret(1 * kPointerSize); | |
| 476 | |
| 477 // Need to collect. Call into runtime system. | |
| 478 __ bind(&gc); | |
| 479 __ TailCallRuntime(Runtime::kNewFunctionContext, 1, 1); | |
| 480 } | |
| 481 | |
| 482 | |
| 483 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { | 451 void FastNewBlockContextStub::Generate(MacroAssembler* masm) { |
| 484 // Stack layout on entry: | 452 // Stack layout on entry: |
| 485 // | 453 // |
| 486 // [rsp + (1 * kPointerSize)] : function | 454 // [rsp + (1 * kPointerSize)] : function |
| 487 // [rsp + (2 * kPointerSize)] : serialized scope info | 455 // [rsp + (2 * kPointerSize)] : serialized scope info |
| 488 | 456 |
| 489 // Try to allocate the context in new space. | 457 // Try to allocate the context in new space. |
| 490 Label gc; | 458 Label gc; |
| 491 int length = slots_ + Context::MIN_CONTEXT_SLOTS; | 459 int length = slots_ + Context::MIN_CONTEXT_SLOTS; |
| 492 __ Allocate(FixedArray::SizeFor(length), | 460 __ Allocate(FixedArray::SizeFor(length), |
| (...skipping 4745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5238 __ bind(&fast_elements_case); | 5206 __ bind(&fast_elements_case); |
| 5239 GenerateCase(masm, FAST_ELEMENTS); | 5207 GenerateCase(masm, FAST_ELEMENTS); |
| 5240 } | 5208 } |
| 5241 | 5209 |
| 5242 | 5210 |
| 5243 #undef __ | 5211 #undef __ |
| 5244 | 5212 |
| 5245 } } // namespace v8::internal | 5213 } } // namespace v8::internal |
| 5246 | 5214 |
| 5247 #endif // V8_TARGET_ARCH_X64 | 5215 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |