| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_CODE_STUBS_H_ | 28 #ifndef V8_CODE_STUBS_H_ |
| 29 #define V8_CODE_STUBS_H_ | 29 #define V8_CODE_STUBS_H_ |
| 30 | 30 |
| 31 #include "allocation.h" | 31 #include "allocation.h" |
| 32 #include "assembler.h" | 32 #include "assembler.h" |
| 33 #include "codegen.h" |
| 33 #include "globals.h" | 34 #include "globals.h" |
| 34 #include "codegen.h" | 35 #include "macro-assembler.h" |
| 35 | 36 |
| 36 namespace v8 { | 37 namespace v8 { |
| 37 namespace internal { | 38 namespace internal { |
| 38 | 39 |
| 39 // List of code stubs used on all platforms. | 40 // List of code stubs used on all platforms. |
| 40 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 41 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 41 V(CallFunction) \ | 42 V(CallFunction) \ |
| 42 V(CallConstruct) \ | 43 V(CallConstruct) \ |
| 43 V(BinaryOp) \ | 44 V(BinaryOp) \ |
| 44 V(StringAdd) \ | 45 V(StringAdd) \ |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 virtual void Generate(MacroAssembler* masm) = 0; | 274 virtual void Generate(MacroAssembler* masm) = 0; |
| 274 }; | 275 }; |
| 275 | 276 |
| 276 | 277 |
| 277 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; | 278 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; |
| 278 | 279 |
| 279 | 280 |
| 280 struct CodeStubInterfaceDescriptor { | 281 struct CodeStubInterfaceDescriptor { |
| 281 CodeStubInterfaceDescriptor(); | 282 CodeStubInterfaceDescriptor(); |
| 282 int register_param_count_; | 283 int register_param_count_; |
| 283 const Register* stack_parameter_count_; | 284 Register stack_parameter_count_; |
| 284 // if hint_stack_parameter_count_ > 0, the code stub can optimize the | 285 // if hint_stack_parameter_count_ > 0, the code stub can optimize the |
| 285 // return sequence. Default value is -1, which means it is ignored. | 286 // return sequence. Default value is -1, which means it is ignored. |
| 286 int hint_stack_parameter_count_; | 287 int hint_stack_parameter_count_; |
| 287 StubFunctionMode function_mode_; | 288 StubFunctionMode function_mode_; |
| 288 Register* register_params_; | 289 Register* register_params_; |
| 289 Address deoptimization_handler_; | 290 Address deoptimization_handler_; |
| 290 | 291 |
| 291 int environment_length() const { | 292 int environment_length() const { |
| 292 if (stack_parameter_count_ != NULL) { | 293 if (stack_parameter_count_.is_valid()) { |
| 293 return register_param_count_ + 1; | 294 return register_param_count_ + 1; |
| 294 } | 295 } |
| 295 return register_param_count_; | 296 return register_param_count_; |
| 296 } | 297 } |
| 297 | 298 |
| 298 bool initialized() const { return register_param_count_ >= 0; } | 299 bool initialized() const { return register_param_count_ >= 0; } |
| 299 | 300 |
| 300 void SetMissHandler(ExternalReference handler) { | 301 void SetMissHandler(ExternalReference handler) { |
| 301 miss_handler_ = handler; | 302 miss_handler_ = handler; |
| 302 has_miss_handler_ = true; | 303 has_miss_handler_ = true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 313 | 314 |
| 314 private: | 315 private: |
| 315 ExternalReference miss_handler_; | 316 ExternalReference miss_handler_; |
| 316 bool has_miss_handler_; | 317 bool has_miss_handler_; |
| 317 }; | 318 }; |
| 318 | 319 |
| 319 // A helper to make up for the fact that type Register is not fully | 320 // A helper to make up for the fact that type Register is not fully |
| 320 // defined outside of the platform directories | 321 // defined outside of the platform directories |
| 321 #define DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index) \ | 322 #define DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index) \ |
| 322 ((index) == (descriptor)->register_param_count_) \ | 323 ((index) == (descriptor)->register_param_count_) \ |
| 323 ? *((descriptor)->stack_parameter_count_) \ | 324 ? (descriptor)->stack_parameter_count_ \ |
| 324 : (descriptor)->register_params_[(index)] | 325 : (descriptor)->register_params_[(index)] |
| 325 | 326 |
| 326 | 327 |
| 327 class HydrogenCodeStub : public CodeStub { | 328 class HydrogenCodeStub : public CodeStub { |
| 328 public: | 329 public: |
| 329 enum InitializationState { | 330 enum InitializationState { |
| 330 UNINITIALIZED, | 331 UNINITIALIZED, |
| 331 INITIALIZED | 332 INITIALIZED |
| 332 }; | 333 }; |
| 333 | 334 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // TODO(bmeurer): Move to the StringAddStub declaration once we're | 398 // TODO(bmeurer): Move to the StringAddStub declaration once we're |
| 398 // done with the translation to a hydrogen code stub. | 399 // done with the translation to a hydrogen code stub. |
| 399 enum StringAddFlags { | 400 enum StringAddFlags { |
| 400 // Omit both parameter checks. | 401 // Omit both parameter checks. |
| 401 STRING_ADD_CHECK_NONE = 0, | 402 STRING_ADD_CHECK_NONE = 0, |
| 402 // Check left parameter. | 403 // Check left parameter. |
| 403 STRING_ADD_CHECK_LEFT = 1 << 0, | 404 STRING_ADD_CHECK_LEFT = 1 << 0, |
| 404 // Check right parameter. | 405 // Check right parameter. |
| 405 STRING_ADD_CHECK_RIGHT = 1 << 1, | 406 STRING_ADD_CHECK_RIGHT = 1 << 1, |
| 406 // Check both parameters. | 407 // Check both parameters. |
| 407 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT, | 408 STRING_ADD_CHECK_BOTH = STRING_ADD_CHECK_LEFT | STRING_ADD_CHECK_RIGHT |
| 408 // Stub needs a frame before calling the runtime | |
| 409 STRING_ADD_ERECT_FRAME = 1 << 2 | |
| 410 }; | 409 }; |
| 411 | 410 |
| 412 } } // namespace v8::internal | 411 } } // namespace v8::internal |
| 413 | 412 |
| 414 #if V8_TARGET_ARCH_IA32 | 413 #if V8_TARGET_ARCH_IA32 |
| 415 #include "ia32/code-stubs-ia32.h" | 414 #include "ia32/code-stubs-ia32.h" |
| 416 #elif V8_TARGET_ARCH_X64 | 415 #elif V8_TARGET_ARCH_X64 |
| 417 #include "x64/code-stubs-x64.h" | 416 #include "x64/code-stubs-x64.h" |
| 418 #elif V8_TARGET_ARCH_ARM | 417 #elif V8_TARGET_ARCH_ARM |
| 419 #include "arm/code-stubs-arm.h" | 418 #include "arm/code-stubs-arm.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { | 468 class NumberToStringStub V8_FINAL : public HydrogenCodeStub { |
| 470 public: | 469 public: |
| 471 NumberToStringStub() {} | 470 NumberToStringStub() {} |
| 472 | 471 |
| 473 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; | 472 virtual Handle<Code> GenerateCode(Isolate* isolate) V8_OVERRIDE; |
| 474 | 473 |
| 475 virtual void InitializeInterfaceDescriptor( | 474 virtual void InitializeInterfaceDescriptor( |
| 476 Isolate* isolate, | 475 Isolate* isolate, |
| 477 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 476 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 478 | 477 |
| 478 static void InstallDescriptors(Isolate* isolate); |
| 479 |
| 479 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 480 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 480 static const int kNumber = 0; | 481 static const int kNumber = 0; |
| 481 | 482 |
| 482 private: | 483 private: |
| 483 virtual Major MajorKey() V8_OVERRIDE { return NumberToString; } | 484 virtual Major MajorKey() V8_OVERRIDE { return NumberToString; } |
| 484 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } | 485 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } |
| 485 }; | 486 }; |
| 486 | 487 |
| 487 | 488 |
| 488 class FastNewClosureStub : public HydrogenCodeStub { | 489 class FastNewClosureStub : public HydrogenCodeStub { |
| (...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 int MinorKey() { return 0; } | 2357 int MinorKey() { return 0; } |
| 2357 | 2358 |
| 2358 void Generate(MacroAssembler* masm); | 2359 void Generate(MacroAssembler* masm); |
| 2359 | 2360 |
| 2360 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2361 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2361 }; | 2362 }; |
| 2362 | 2363 |
| 2363 } } // namespace v8::internal | 2364 } } // namespace v8::internal |
| 2364 | 2365 |
| 2365 #endif // V8_CODE_STUBS_H_ | 2366 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |