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

Side by Side Diff: src/factory.h

Issue 1295093002: Do not use js builtins object when constructing an error. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix failures. Created 5 years, 4 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
« no previous file with comments | « src/contexts.h ('k') | src/factory.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 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 bool immovable = false, 539 bool immovable = false,
540 bool crankshafted = false, 540 bool crankshafted = false,
541 int prologue_offset = Code::kPrologueOffsetNotSet, 541 int prologue_offset = Code::kPrologueOffsetNotSet,
542 bool is_debug = false); 542 bool is_debug = false);
543 543
544 Handle<Code> CopyCode(Handle<Code> code); 544 Handle<Code> CopyCode(Handle<Code> code);
545 545
546 Handle<Code> CopyCode(Handle<Code> code, Vector<byte> reloc_info); 546 Handle<Code> CopyCode(Handle<Code> code, Vector<byte> reloc_info);
547 547
548 // Interface for creating error objects. 548 // Interface for creating error objects.
549
550 Handle<Object> NewError(const char* maker, const char* message,
551 Handle<JSArray> args);
552 Handle<String> EmergencyNewError(const char* message, Handle<JSArray> args);
553
554 Handle<Object> NewError(Handle<JSFunction> constructor, 549 Handle<Object> NewError(Handle<JSFunction> constructor,
555 Handle<String> message); 550 Handle<String> message);
556 551
557 Handle<Object> NewInvalidStringLengthError() { 552 Handle<Object> NewInvalidStringLengthError() {
558 return NewRangeError(MessageTemplate::kInvalidStringLength); 553 return NewRangeError(MessageTemplate::kInvalidStringLength);
559 } 554 }
560 555
561 Handle<Object> NewError(const char* maker, 556 Handle<Object> NewError(Handle<JSFunction> constructor,
562 MessageTemplate::Template template_index, 557 MessageTemplate::Template template_index,
563 Handle<Object> arg0 = Handle<Object>(), 558 Handle<Object> arg0 = Handle<Object>(),
564 Handle<Object> arg1 = Handle<Object>(), 559 Handle<Object> arg1 = Handle<Object>(),
565 Handle<Object> arg2 = Handle<Object>()); 560 Handle<Object> arg2 = Handle<Object>());
566 561
567 Handle<Object> NewError(MessageTemplate::Template template_index, 562 #define DEFINE_ERROR(NAME, name) \
568 Handle<Object> arg0 = Handle<Object>(), 563 Handle<Object> New##NAME(MessageTemplate::Template template_index, \
569 Handle<Object> arg1 = Handle<Object>(), 564 Handle<Object> arg0 = Handle<Object>(), \
570 Handle<Object> arg2 = Handle<Object>()); 565 Handle<Object> arg1 = Handle<Object>(), \
566 Handle<Object> arg2 = Handle<Object>()) { \
567 return NewError(isolate()->name##_function(), template_index, arg0, arg1, \
568 arg2); \
569 }
571 570
572 Handle<Object> NewTypeError(MessageTemplate::Template template_index, 571 DEFINE_ERROR(Error, error)
573 Handle<Object> arg0 = Handle<Object>(), 572 DEFINE_ERROR(EvalError, eval_error)
574 Handle<Object> arg1 = Handle<Object>(), 573 DEFINE_ERROR(RangeError, range_error)
575 Handle<Object> arg2 = Handle<Object>()); 574 DEFINE_ERROR(ReferenceError, reference_error)
576 575 DEFINE_ERROR(SyntaxError, syntax_error)
577 Handle<Object> NewSyntaxError(MessageTemplate::Template template_index, 576 DEFINE_ERROR(TypeError, type_error)
578 Handle<Object> arg0 = Handle<Object>(), 577 #undef DEFINE_ERROR
579 Handle<Object> arg1 = Handle<Object>(),
580 Handle<Object> arg2 = Handle<Object>());
581
582 Handle<Object> NewReferenceError(MessageTemplate::Template template_index,
583 Handle<Object> arg0 = Handle<Object>(),
584 Handle<Object> arg1 = Handle<Object>(),
585 Handle<Object> arg2 = Handle<Object>());
586
587 Handle<Object> NewRangeError(MessageTemplate::Template template_index,
588 Handle<Object> arg0 = Handle<Object>(),
589 Handle<Object> arg1 = Handle<Object>(),
590 Handle<Object> arg2 = Handle<Object>());
591
592 Handle<Object> NewEvalError(MessageTemplate::Template template_index,
593 Handle<Object> arg0 = Handle<Object>(),
594 Handle<Object> arg1 = Handle<Object>(),
595 Handle<Object> arg2 = Handle<Object>());
596 578
597 Handle<String> NumberToString(Handle<Object> number, 579 Handle<String> NumberToString(Handle<Object> number,
598 bool check_number_string_cache = true); 580 bool check_number_string_cache = true);
599 581
600 Handle<String> Uint32ToString(uint32_t value) { 582 Handle<String> Uint32ToString(uint32_t value) {
601 return NumberToString(NewNumberFromUint(value)); 583 return NumberToString(NewNumberFromUint(value));
602 } 584 }
603 585
604 Handle<JSFunction> InstallMembers(Handle<JSFunction> function); 586 Handle<JSFunction> InstallMembers(Handle<JSFunction> function);
605 587
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 // Reinitialize a JSProxy into an (empty) JS object of respective type and 735 // Reinitialize a JSProxy into an (empty) JS object of respective type and
754 // size, but keeping the original prototype. The receiver must have at least 736 // size, but keeping the original prototype. The receiver must have at least
755 // the size of the new object. The object is reinitialized and behaves as an 737 // the size of the new object. The object is reinitialized and behaves as an
756 // object that has been freshly allocated. 738 // object that has been freshly allocated.
757 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); 739 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size);
758 }; 740 };
759 741
760 } } // namespace v8::internal 742 } } // namespace v8::internal
761 743
762 #endif // V8_FACTORY_H_ 744 #endif // V8_FACTORY_H_
OLDNEW
« no previous file with comments | « src/contexts.h ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698