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

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

Issue 19793005: Turn ToNumberStub into a hydrogen code stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 25 matching lines...) Expand all
36 #include "regexp-macro-assembler.h" 36 #include "regexp-macro-assembler.h"
37 #include "runtime.h" 37 #include "runtime.h"
38 #include "stub-cache.h" 38 #include "stub-cache.h"
39 #include "codegen.h" 39 #include "codegen.h"
40 #include "runtime.h" 40 #include "runtime.h"
41 41
42 namespace v8 { 42 namespace v8 {
43 namespace internal { 43 namespace internal {
44 44
45 45
46 void ToNumberStub::InitializeInterfaceDescriptor(
47 Isolate* isolate,
48 CodeStubInterfaceDescriptor* descriptor) {
49 static Register registers[] = { eax };
50 descriptor->register_param_count_ = 1;
51 descriptor->register_params_ = registers;
52 descriptor->deoptimization_handler_ = NULL;
53 }
54
55
46 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( 56 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
47 Isolate* isolate, 57 Isolate* isolate,
48 CodeStubInterfaceDescriptor* descriptor) { 58 CodeStubInterfaceDescriptor* descriptor) {
49 static Register registers[] = { eax, ebx, ecx }; 59 static Register registers[] = { eax, ebx, ecx };
50 descriptor->register_param_count_ = 3; 60 descriptor->register_param_count_ = 3;
51 descriptor->register_params_ = registers; 61 descriptor->register_params_ = registers;
52 descriptor->deoptimization_handler_ = 62 descriptor->deoptimization_handler_ =
53 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry; 63 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry;
54 } 64 }
55 65
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 __ push(descriptor->register_params_[i]); 303 __ push(descriptor->register_params_[i]);
294 } 304 }
295 ExternalReference miss = descriptor->miss_handler(); 305 ExternalReference miss = descriptor->miss_handler();
296 __ CallExternalReference(miss, descriptor->register_param_count_); 306 __ CallExternalReference(miss, descriptor->register_param_count_);
297 } 307 }
298 308
299 __ ret(0); 309 __ ret(0);
300 } 310 }
301 311
302 312
303 void ToNumberStub::Generate(MacroAssembler* masm) {
304 // The ToNumber stub takes one argument in eax.
305 Label check_heap_number, call_builtin;
306 __ JumpIfNotSmi(eax, &check_heap_number, Label::kNear);
307 __ ret(0);
308
309 __ bind(&check_heap_number);
310 __ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
311 Factory* factory = masm->isolate()->factory();
312 __ cmp(ebx, Immediate(factory->heap_number_map()));
313 __ j(not_equal, &call_builtin, Label::kNear);
314 __ ret(0);
315
316 __ bind(&call_builtin);
317 __ pop(ecx); // Pop return address.
318 __ push(eax);
319 __ push(ecx); // Push return address.
320 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
321 }
322
323
324 void FastNewClosureStub::Generate(MacroAssembler* masm) { 313 void FastNewClosureStub::Generate(MacroAssembler* masm) {
325 // Create a new closure from the given function info in new 314 // Create a new closure from the given function info in new
326 // space. Set the context to the current context in esi. 315 // space. Set the context to the current context in esi.
327 Counters* counters = masm->isolate()->counters(); 316 Counters* counters = masm->isolate()->counters();
328 317
329 Label gc; 318 Label gc;
330 __ Allocate(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); 319 __ Allocate(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT);
331 320
332 __ IncrementCounter(counters->fast_new_closure_total(), 1); 321 __ IncrementCounter(counters->fast_new_closure_total(), 1);
333 322
(...skipping 7434 matching lines...) Expand 10 before | Expand all | Expand 10 after
7768 __ bind(&fast_elements_case); 7757 __ bind(&fast_elements_case);
7769 GenerateCase(masm, FAST_ELEMENTS); 7758 GenerateCase(masm, FAST_ELEMENTS);
7770 } 7759 }
7771 7760
7772 7761
7773 #undef __ 7762 #undef __
7774 7763
7775 } } // namespace v8::internal 7764 } } // namespace v8::internal
7776 7765
7777 #endif // V8_TARGET_ARCH_IA32 7766 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698