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

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

Issue 6350021: Introduce ToNumber stub and use it in non-optimized code for to-number conver... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 11 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 19 matching lines...) Expand all
30 #if defined(V8_TARGET_ARCH_X64) 30 #if defined(V8_TARGET_ARCH_X64)
31 31
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "code-stubs.h" 33 #include "code-stubs.h"
34 #include "regexp-macro-assembler.h" 34 #include "regexp-macro-assembler.h"
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 #define __ ACCESS_MASM(masm) 39 #define __ ACCESS_MASM(masm)
40
41 void ToNumberStub::Generate(MacroAssembler* masm) {
42 // The ToNumber stub takes one argument in eax.
43 // It is assumed to be already smi-checked.
William Hesse 2011/01/28 14:12:28 This comment is probably wrong. Otherwise, we wou
fschneider 2011/01/28 14:17:32 Done.
44 NearLabel check_heap_number, call_builtin;
45 __ SmiTest(rax);
46 __ j(not_zero, &check_heap_number);
47 __ ret(0);
William Hesse 2011/01/28 14:12:28 Ret() is an alternative to ret(0).
fschneider 2011/01/28 14:17:32 Done.
48
49 __ bind(&check_heap_number);
50 __ Move(rbx, Factory::heap_number_map());
51 __ cmpq(rbx, FieldOperand(rax, HeapObject::kMapOffset));
52 __ j(not_equal, &call_builtin);
53 __ ret(0);
54
55 __ bind(&call_builtin);
56 __ pop(rcx); // Pop return address.
57 __ push(rax);
58 __ push(rcx); // Push return address.
59 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
60 }
61
62
40 void FastNewClosureStub::Generate(MacroAssembler* masm) { 63 void FastNewClosureStub::Generate(MacroAssembler* masm) {
41 // Create a new closure from the given function info in new 64 // Create a new closure from the given function info in new
42 // space. Set the context to the current context in rsi. 65 // space. Set the context to the current context in rsi.
43 Label gc; 66 Label gc;
44 __ AllocateInNewSpace(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT); 67 __ AllocateInNewSpace(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT);
45 68
46 // Get the function info from the stack. 69 // Get the function info from the stack.
47 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); 70 __ movq(rdx, Operand(rsp, 1 * kPointerSize));
48 71
49 // Compute the function map in the current global context and set that 72 // Compute the function map in the current global context and set that
(...skipping 4340 matching lines...) Expand 10 before | Expand all | Expand 10 after
4390 4413
4391 // Do a tail call to the rewritten stub. 4414 // Do a tail call to the rewritten stub.
4392 __ jmp(rdi); 4415 __ jmp(rdi);
4393 } 4416 }
4394 4417
4395 #undef __ 4418 #undef __
4396 4419
4397 } } // namespace v8::internal 4420 } } // namespace v8::internal
4398 4421
4399 #endif // V8_TARGET_ARCH_X64 4422 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698