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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 | 62 |
63 void FastNewClosureStub::Generate(MacroAssembler* masm) { | 63 void FastNewClosureStub::Generate(MacroAssembler* masm) { |
64 // Create a new closure from the given function info in new | 64 // Create a new closure from the given function info in new |
65 // space. Set the context to the current context in esi. | 65 // space. Set the context to the current context in esi. |
66 Label gc; | 66 Label gc; |
67 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); | 67 __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); |
68 | 68 |
69 // Get the function info from the stack. | 69 // Get the function info from the stack. |
70 __ mov(edx, Operand(esp, 1 * kPointerSize)); | 70 __ mov(edx, Operand(esp, 1 * kPointerSize)); |
71 | 71 |
72 int map_index = strict_mode_ == kStrictMode | |
73 ? Context::FUNCTION_MAP_STRICT_INDEX | |
Mads Ager (chromium)
2011/03/15 08:49:54
This is part of another change but I think I would
| |
74 : Context::FUNCTION_MAP_INDEX; | |
75 | |
72 // Compute the function map in the current global context and set that | 76 // Compute the function map in the current global context and set that |
73 // as the map of the allocated object. | 77 // as the map of the allocated object. |
74 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 78 __ mov(ecx, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
75 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalContextOffset)); | 79 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalContextOffset)); |
76 __ mov(ecx, Operand(ecx, Context::SlotOffset(Context::FUNCTION_MAP_INDEX))); | 80 __ mov(ecx, Operand(ecx, Context::SlotOffset(map_index))); |
77 __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx); | 81 __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx); |
78 | 82 |
79 // Initialize the rest of the function. We don't have to update the | 83 // Initialize the rest of the function. We don't have to update the |
80 // write barrier because the allocated object is in new space. | 84 // write barrier because the allocated object is in new space. |
81 __ mov(ebx, Immediate(Factory::empty_fixed_array())); | 85 __ mov(ebx, Immediate(Factory::empty_fixed_array())); |
82 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ebx); | 86 __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ebx); |
83 __ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx); | 87 __ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx); |
84 __ mov(FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset), | 88 __ mov(FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset), |
85 Immediate(Factory::the_hole_value())); | 89 Immediate(Factory::the_hole_value())); |
86 __ mov(FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset), edx); | 90 __ mov(FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset), edx); |
(...skipping 6338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6425 // Do a tail call to the rewritten stub. | 6429 // Do a tail call to the rewritten stub. |
6426 __ jmp(Operand(edi)); | 6430 __ jmp(Operand(edi)); |
6427 } | 6431 } |
6428 | 6432 |
6429 | 6433 |
6430 #undef __ | 6434 #undef __ |
6431 | 6435 |
6432 } } // namespace v8::internal | 6436 } } // namespace v8::internal |
6433 | 6437 |
6434 #endif // V8_TARGET_ARCH_IA32 | 6438 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |