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

Side by Side Diff: src/arm/code-stubs-arm.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 | « no previous file | src/code-stubs.h » ('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 20 matching lines...) Expand all
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 #include "stub-cache.h" 35 #include "stub-cache.h"
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 40
41 void ToNumberStub::InitializeInterfaceDescriptor(
42 Isolate* isolate,
43 CodeStubInterfaceDescriptor* descriptor) {
44 static Register registers[] = { r0 };
45 descriptor->register_param_count_ = 1;
46 descriptor->register_params_ = registers;
47 descriptor->deoptimization_handler_ = NULL;
48 }
49
50
41 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( 51 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
42 Isolate* isolate, 52 Isolate* isolate,
43 CodeStubInterfaceDescriptor* descriptor) { 53 CodeStubInterfaceDescriptor* descriptor) {
44 static Register registers[] = { r3, r2, r1 }; 54 static Register registers[] = { r3, r2, r1 };
45 descriptor->register_param_count_ = 3; 55 descriptor->register_param_count_ = 3;
46 descriptor->register_params_ = registers; 56 descriptor->register_params_ = registers;
47 descriptor->deoptimization_handler_ = 57 descriptor->deoptimization_handler_ =
48 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry; 58 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry;
49 } 59 }
50 60
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 Register lhs, 289 Register lhs,
280 Register rhs, 290 Register rhs,
281 Label* lhs_not_nan, 291 Label* lhs_not_nan,
282 Label* slow, 292 Label* slow,
283 bool strict); 293 bool strict);
284 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, 294 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
285 Register lhs, 295 Register lhs,
286 Register rhs); 296 Register rhs);
287 297
288 298
289 // Check if the operand is a heap number.
290 static void EmitCheckForHeapNumber(MacroAssembler* masm, Register operand,
291 Register scratch1, Register scratch2,
292 Label* not_a_heap_number) {
293 __ ldr(scratch1, FieldMemOperand(operand, HeapObject::kMapOffset));
294 __ LoadRoot(scratch2, Heap::kHeapNumberMapRootIndex);
295 __ cmp(scratch1, scratch2);
296 __ b(ne, not_a_heap_number);
297 }
298
299
300 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { 299 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) {
301 // Update the static counter each time a new code stub is generated. 300 // Update the static counter each time a new code stub is generated.
302 Isolate* isolate = masm->isolate(); 301 Isolate* isolate = masm->isolate();
303 isolate->counters()->code_stubs()->Increment(); 302 isolate->counters()->code_stubs()->Increment();
304 303
305 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate); 304 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate);
306 int param_count = descriptor->register_param_count_; 305 int param_count = descriptor->register_param_count_;
307 { 306 {
308 // Call the runtime system in a fresh internal frame. 307 // Call the runtime system in a fresh internal frame.
309 FrameScope scope(masm, StackFrame::INTERNAL); 308 FrameScope scope(masm, StackFrame::INTERNAL);
310 ASSERT(descriptor->register_param_count_ == 0 || 309 ASSERT(descriptor->register_param_count_ == 0 ||
311 r0.is(descriptor->register_params_[param_count - 1])); 310 r0.is(descriptor->register_params_[param_count - 1]));
312 // Push arguments 311 // Push arguments
313 for (int i = 0; i < param_count; ++i) { 312 for (int i = 0; i < param_count; ++i) {
314 __ push(descriptor->register_params_[i]); 313 __ push(descriptor->register_params_[i]);
315 } 314 }
316 ExternalReference miss = descriptor->miss_handler(); 315 ExternalReference miss = descriptor->miss_handler();
317 __ CallExternalReference(miss, descriptor->register_param_count_); 316 __ CallExternalReference(miss, descriptor->register_param_count_);
318 } 317 }
319 318
320 __ Ret(); 319 __ Ret();
321 } 320 }
322 321
323 322
324 void ToNumberStub::Generate(MacroAssembler* masm) {
325 // The ToNumber stub takes one argument in eax.
326 Label check_heap_number, call_builtin;
327 __ JumpIfNotSmi(r0, &check_heap_number);
328 __ Ret();
329
330 __ bind(&check_heap_number);
331 EmitCheckForHeapNumber(masm, r0, r1, ip, &call_builtin);
332 __ Ret();
333
334 __ bind(&call_builtin);
335 __ push(r0);
336 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION);
337 }
338
339
340 void FastNewClosureStub::Generate(MacroAssembler* masm) { 323 void FastNewClosureStub::Generate(MacroAssembler* masm) {
341 // Create a new closure from the given function info in new 324 // Create a new closure from the given function info in new
342 // space. Set the context to the current context in cp. 325 // space. Set the context to the current context in cp.
343 Counters* counters = masm->isolate()->counters(); 326 Counters* counters = masm->isolate()->counters();
344 327
345 Label gc; 328 Label gc;
346 329
347 // Pop the function info from the stack. 330 // Pop the function info from the stack.
348 __ pop(r3); 331 __ pop(r3);
349 332
(...skipping 6842 matching lines...) Expand 10 before | Expand all | Expand 10 after
7192 __ bind(&fast_elements_case); 7175 __ bind(&fast_elements_case);
7193 GenerateCase(masm, FAST_ELEMENTS); 7176 GenerateCase(masm, FAST_ELEMENTS);
7194 } 7177 }
7195 7178
7196 7179
7197 #undef __ 7180 #undef __
7198 7181
7199 } } // namespace v8::internal 7182 } } // namespace v8::internal
7200 7183
7201 #endif // V8_TARGET_ARCH_ARM 7184 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698