OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 void FastNewClosureStub::Generate(MacroAssembler* masm) { | 62 void FastNewClosureStub::Generate(MacroAssembler* masm) { |
63 // Create a new closure from the given function info in new | 63 // Create a new closure from the given function info in new |
64 // space. Set the context to the current context in rsi. | 64 // space. Set the context to the current context in rsi. |
65 Label gc; | 65 Label gc; |
66 __ AllocateInNewSpace(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT); | 66 __ AllocateInNewSpace(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT); |
67 | 67 |
68 // Get the function info from the stack. | 68 // Get the function info from the stack. |
69 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); | 69 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); |
70 | 70 |
71 int map_index = strict_mode_ == kStrictMode | 71 int map_index = (language_mode_ == CLASSIC_MODE) |
72 ? Context::STRICT_MODE_FUNCTION_MAP_INDEX | 72 ? Context::FUNCTION_MAP_INDEX |
73 : Context::FUNCTION_MAP_INDEX; | 73 : Context::STRICT_MODE_FUNCTION_MAP_INDEX; |
74 | 74 |
75 // Compute the function map in the current global context and set that | 75 // Compute the function map in the current global context and set that |
76 // as the map of the allocated object. | 76 // as the map of the allocated object. |
77 __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 77 __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
78 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset)); | 78 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset)); |
79 __ movq(rcx, Operand(rcx, Context::SlotOffset(map_index))); | 79 __ movq(rcx, Operand(rcx, Context::SlotOffset(map_index))); |
80 __ movq(FieldOperand(rax, JSObject::kMapOffset), rcx); | 80 __ movq(FieldOperand(rax, JSObject::kMapOffset), rcx); |
81 | 81 |
82 // Initialize the rest of the function. We don't have to update the | 82 // Initialize the rest of the function. We don't have to update the |
83 // write barrier because the allocated object is in new space. | 83 // write barrier because the allocated object is in new space. |
(...skipping 5943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6027 xmm0, | 6027 xmm0, |
6028 &slow_elements); | 6028 &slow_elements); |
6029 __ ret(0); | 6029 __ ret(0); |
6030 } | 6030 } |
6031 | 6031 |
6032 #undef __ | 6032 #undef __ |
6033 | 6033 |
6034 } } // namespace v8::internal | 6034 } } // namespace v8::internal |
6035 | 6035 |
6036 #endif // V8_TARGET_ARCH_X64 | 6036 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |