OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_FACTORY_H_ | 5 #ifndef V8_FACTORY_H_ |
6 #define V8_FACTORY_H_ | 6 #define V8_FACTORY_H_ |
7 | 7 |
8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
9 #include "src/messages.h" | 9 #include "src/messages.h" |
10 | 10 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 Handle<Object> NewInvalidStringLengthError() { | 550 Handle<Object> NewInvalidStringLengthError() { |
551 return NewRangeError(MessageTemplate::kInvalidStringLength); | 551 return NewRangeError(MessageTemplate::kInvalidStringLength); |
552 } | 552 } |
553 | 553 |
554 Handle<Object> NewError(Handle<JSFunction> constructor, | 554 Handle<Object> NewError(Handle<JSFunction> constructor, |
555 MessageTemplate::Template template_index, | 555 MessageTemplate::Template template_index, |
556 Handle<Object> arg0 = Handle<Object>(), | 556 Handle<Object> arg0 = Handle<Object>(), |
557 Handle<Object> arg1 = Handle<Object>(), | 557 Handle<Object> arg1 = Handle<Object>(), |
558 Handle<Object> arg2 = Handle<Object>()); | 558 Handle<Object> arg2 = Handle<Object>()); |
559 | 559 |
560 #define DEFINE_ERROR(NAME, name) \ | 560 #define DECLARE_ERROR(NAME) \ |
561 Handle<Object> New##NAME(MessageTemplate::Template template_index, \ | 561 Handle<Object> New##NAME(MessageTemplate::Template template_index, \ |
562 Handle<Object> arg0 = Handle<Object>(), \ | 562 Handle<Object> arg0 = Handle<Object>(), \ |
563 Handle<Object> arg1 = Handle<Object>(), \ | 563 Handle<Object> arg1 = Handle<Object>(), \ |
564 Handle<Object> arg2 = Handle<Object>()) { \ | 564 Handle<Object> arg2 = Handle<Object>()); |
565 return NewError(isolate()->name##_function(), template_index, arg0, arg1, \ | 565 DECLARE_ERROR(Error) |
566 arg2); \ | 566 DECLARE_ERROR(EvalError) |
567 } | 567 DECLARE_ERROR(RangeError) |
568 | 568 DECLARE_ERROR(ReferenceError) |
569 DEFINE_ERROR(Error, error) | 569 DECLARE_ERROR(SyntaxError) |
570 DEFINE_ERROR(EvalError, eval_error) | 570 DECLARE_ERROR(TypeError) |
571 DEFINE_ERROR(RangeError, range_error) | |
572 DEFINE_ERROR(ReferenceError, reference_error) | |
573 DEFINE_ERROR(SyntaxError, syntax_error) | |
574 DEFINE_ERROR(TypeError, type_error) | |
575 #undef DEFINE_ERROR | 571 #undef DEFINE_ERROR |
576 | 572 |
577 Handle<String> NumberToString(Handle<Object> number, | 573 Handle<String> NumberToString(Handle<Object> number, |
578 bool check_number_string_cache = true); | 574 bool check_number_string_cache = true); |
579 | 575 |
580 Handle<String> Uint32ToString(uint32_t value) { | 576 Handle<String> Uint32ToString(uint32_t value) { |
581 return NumberToString(NewNumberFromUint(value)); | 577 return NumberToString(NewNumberFromUint(value)); |
582 } | 578 } |
583 | 579 |
584 Handle<JSFunction> InstallMembers(Handle<JSFunction> function); | 580 Handle<JSFunction> InstallMembers(Handle<JSFunction> function); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 // Reinitialize a JSProxy into an (empty) JS object of respective type and | 717 // Reinitialize a JSProxy into an (empty) JS object of respective type and |
722 // size, but keeping the original prototype. The receiver must have at least | 718 // size, but keeping the original prototype. The receiver must have at least |
723 // the size of the new object. The object is reinitialized and behaves as an | 719 // the size of the new object. The object is reinitialized and behaves as an |
724 // object that has been freshly allocated. | 720 // object that has been freshly allocated. |
725 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); | 721 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); |
726 }; | 722 }; |
727 | 723 |
728 } } // namespace v8::internal | 724 } } // namespace v8::internal |
729 | 725 |
730 #endif // V8_FACTORY_H_ | 726 #endif // V8_FACTORY_H_ |
OLD | NEW |