Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 6677036: Fast path for strict closure creation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
72 ? Context::FUNCTION_MAP_STRICT_INDEX
73 : Context::FUNCTION_MAP_INDEX;
74
71 // 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
72 // as the map of the allocated object. 76 // as the map of the allocated object.
73 __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); 77 __ movq(rcx, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
74 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset)); 78 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalContextOffset));
75 __ movq(rcx, Operand(rcx, Context::SlotOffset(Context::FUNCTION_MAP_INDEX))); 79 __ movq(rcx, Operand(rcx, Context::SlotOffset(map_index)));
76 __ movq(FieldOperand(rax, JSObject::kMapOffset), rcx); 80 __ movq(FieldOperand(rax, JSObject::kMapOffset), rcx);
77 81
78 // 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
79 // write barrier because the allocated object is in new space. 83 // write barrier because the allocated object is in new space.
80 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); 84 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex);
81 __ LoadRoot(rcx, Heap::kTheHoleValueRootIndex); 85 __ LoadRoot(rcx, Heap::kTheHoleValueRootIndex);
82 __ LoadRoot(rdi, Heap::kUndefinedValueRootIndex); 86 __ LoadRoot(rdi, Heap::kUndefinedValueRootIndex);
83 __ movq(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); 87 __ movq(FieldOperand(rax, JSObject::kPropertiesOffset), rbx);
84 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rbx); 88 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rbx);
85 __ movq(FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset), rcx); 89 __ movq(FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset), rcx);
(...skipping 4938 matching lines...) Expand 10 before | Expand all | Expand 10 after
5024 // Do a tail call to the rewritten stub. 5028 // Do a tail call to the rewritten stub.
5025 __ jmp(rdi); 5029 __ jmp(rdi);
5026 } 5030 }
5027 5031
5028 5032
5029 #undef __ 5033 #undef __
5030 5034
5031 } } // namespace v8::internal 5035 } } // namespace v8::internal
5032 5036
5033 #endif // V8_TARGET_ARCH_X64 5037 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698