| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 21 matching lines...) Expand all Loading... |
| 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 #include "runtime.h" | 36 #include "runtime.h" |
| 37 | 37 |
| 38 namespace v8 { | 38 namespace v8 { |
| 39 namespace internal { | 39 namespace internal { |
| 40 | 40 |
| 41 | 41 |
| 42 void ToNumberStub::InitializeInterfaceDescriptor( |
| 43 Isolate* isolate, |
| 44 CodeStubInterfaceDescriptor* descriptor) { |
| 45 static Register registers[] = { rax }; |
| 46 descriptor->register_param_count_ = 1; |
| 47 descriptor->register_params_ = registers; |
| 48 descriptor->deoptimization_handler_ = NULL; |
| 49 } |
| 50 |
| 51 |
| 42 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | 52 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
| 43 Isolate* isolate, | 53 Isolate* isolate, |
| 44 CodeStubInterfaceDescriptor* descriptor) { | 54 CodeStubInterfaceDescriptor* descriptor) { |
| 45 static Register registers[] = { rax, rbx, rcx }; | 55 static Register registers[] = { rax, rbx, rcx }; |
| 46 descriptor->register_param_count_ = 3; | 56 descriptor->register_param_count_ = 3; |
| 47 descriptor->register_params_ = registers; | 57 descriptor->register_params_ = registers; |
| 48 descriptor->deoptimization_handler_ = | 58 descriptor->deoptimization_handler_ = |
| 49 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry; | 59 Runtime::FunctionForId(Runtime::kCreateArrayLiteralShallow)->entry; |
| 50 } | 60 } |
| 51 | 61 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 __ push(descriptor->register_params_[i]); | 299 __ push(descriptor->register_params_[i]); |
| 290 } | 300 } |
| 291 ExternalReference miss = descriptor->miss_handler(); | 301 ExternalReference miss = descriptor->miss_handler(); |
| 292 __ CallExternalReference(miss, descriptor->register_param_count_); | 302 __ CallExternalReference(miss, descriptor->register_param_count_); |
| 293 } | 303 } |
| 294 | 304 |
| 295 __ Ret(); | 305 __ Ret(); |
| 296 } | 306 } |
| 297 | 307 |
| 298 | 308 |
| 299 void ToNumberStub::Generate(MacroAssembler* masm) { | |
| 300 // The ToNumber stub takes one argument in rax. | |
| 301 Label check_heap_number, call_builtin; | |
| 302 __ SmiTest(rax); | |
| 303 __ j(not_zero, &check_heap_number, Label::kNear); | |
| 304 __ Ret(); | |
| 305 | |
| 306 __ bind(&check_heap_number); | |
| 307 __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), | |
| 308 Heap::kHeapNumberMapRootIndex); | |
| 309 __ j(not_equal, &call_builtin, Label::kNear); | |
| 310 __ Ret(); | |
| 311 | |
| 312 __ bind(&call_builtin); | |
| 313 __ pop(rcx); // Pop return address. | |
| 314 __ push(rax); | |
| 315 __ push(rcx); // Push return address. | |
| 316 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | |
| 317 } | |
| 318 | |
| 319 | |
| 320 void FastNewClosureStub::Generate(MacroAssembler* masm) { | 309 void FastNewClosureStub::Generate(MacroAssembler* masm) { |
| 321 // Create a new closure from the given function info in new | 310 // Create a new closure from the given function info in new |
| 322 // space. Set the context to the current context in rsi. | 311 // space. Set the context to the current context in rsi. |
| 323 Counters* counters = masm->isolate()->counters(); | 312 Counters* counters = masm->isolate()->counters(); |
| 324 | 313 |
| 325 Label gc; | 314 Label gc; |
| 326 __ Allocate(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT); | 315 __ Allocate(JSFunction::kSize, rax, rbx, rcx, &gc, TAG_OBJECT); |
| 327 | 316 |
| 328 __ IncrementCounter(counters->fast_new_closure_total(), 1); | 317 __ IncrementCounter(counters->fast_new_closure_total(), 1); |
| 329 | 318 |
| (...skipping 6497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6827 __ bind(&fast_elements_case); | 6816 __ bind(&fast_elements_case); |
| 6828 GenerateCase(masm, FAST_ELEMENTS); | 6817 GenerateCase(masm, FAST_ELEMENTS); |
| 6829 } | 6818 } |
| 6830 | 6819 |
| 6831 | 6820 |
| 6832 #undef __ | 6821 #undef __ |
| 6833 | 6822 |
| 6834 } } // namespace v8::internal | 6823 } } // namespace v8::internal |
| 6835 | 6824 |
| 6836 #endif // V8_TARGET_ARCH_X64 | 6825 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |