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

Side by Side Diff: src/factory.cc

Issue 1413503007: Provide a counter for thrown JavaScript errors per context (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adaptations to feedback and now all V8 exceptions are counted Created 5 years, 1 month 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
« src/contexts.cc ('K') | « src/counters.h ('k') | no next file » | 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 #include "src/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 return symbol; 719 return symbol;
720 } 720 }
721 721
722 722
723 Handle<Context> Factory::NewNativeContext() { 723 Handle<Context> Factory::NewNativeContext() {
724 Handle<FixedArray> array = 724 Handle<FixedArray> array =
725 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); 725 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED);
726 array->set_map_no_write_barrier(*native_context_map()); 726 array->set_map_no_write_barrier(*native_context_map());
727 Handle<Context> context = Handle<Context>::cast(array); 727 Handle<Context> context = Handle<Context>::cast(array);
728 context->set_js_array_maps(*undefined_value()); 728 context->set_js_array_maps(*undefined_value());
729 context->set_exceptions_thrown(Smi::FromInt(0));
729 DCHECK(context->IsNativeContext()); 730 DCHECK(context->IsNativeContext());
730 return context; 731 return context;
731 } 732 }
732 733
733 734
734 Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function, 735 Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function,
735 Handle<ScopeInfo> scope_info) { 736 Handle<ScopeInfo> scope_info) {
736 Handle<FixedArray> array = 737 Handle<FixedArray> array =
737 NewFixedArray(scope_info->ContextLength(), TENURED); 738 NewFixedArray(scope_info->ContextLength(), TENURED);
738 array->set_map_no_write_barrier(*script_context_map()); 739 array->set_map_no_write_barrier(*script_context_map());
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 return undefined_value(); 1153 return undefined_value();
1153 } 1154 }
1154 return result; 1155 return result;
1155 } 1156 }
1156 1157
1157 1158
1158 #define DEFINE_ERROR(NAME, name) \ 1159 #define DEFINE_ERROR(NAME, name) \
1159 Handle<Object> Factory::New##NAME(MessageTemplate::Template template_index, \ 1160 Handle<Object> Factory::New##NAME(MessageTemplate::Template template_index, \
1160 Handle<Object> arg0, Handle<Object> arg1, \ 1161 Handle<Object> arg0, Handle<Object> arg1, \
1161 Handle<Object> arg2) { \ 1162 Handle<Object> arg2) { \
1163 isolate()->native_context()->IncrementExceptionsThrown(); \
jochen (gone - plz use gerrit) 2015/10/30 12:13:38 this looks wrong. It's not uncommon to do var a =
Yang 2015/10/30 13:01:02 As discussed offline, I suggested to do it in %For
Michael Hablich 2015/10/30 15:55:03 I moved the call to %FormatMessageString. During t
1162 return NewError(isolate()->name##_function(), template_index, arg0, arg1, \ 1164 return NewError(isolate()->name##_function(), template_index, arg0, arg1, \
1163 arg2); \ 1165 arg2); \
1164 } 1166 }
1165 DEFINE_ERROR(Error, error) 1167 DEFINE_ERROR(Error, error)
1166 DEFINE_ERROR(EvalError, eval_error) 1168 DEFINE_ERROR(EvalError, eval_error)
1167 DEFINE_ERROR(RangeError, range_error) 1169 DEFINE_ERROR(RangeError, range_error)
1168 DEFINE_ERROR(ReferenceError, reference_error) 1170 DEFINE_ERROR(ReferenceError, reference_error)
1169 DEFINE_ERROR(SyntaxError, syntax_error) 1171 DEFINE_ERROR(SyntaxError, syntax_error)
1170 DEFINE_ERROR(TypeError, type_error) 1172 DEFINE_ERROR(TypeError, type_error)
1171 #undef DEFINE_ERROR 1173 #undef DEFINE_ERROR
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 } 2391 }
2390 2392
2391 2393
2392 Handle<Object> Factory::ToBoolean(bool value) { 2394 Handle<Object> Factory::ToBoolean(bool value) {
2393 return value ? true_value() : false_value(); 2395 return value ? true_value() : false_value();
2394 } 2396 }
2395 2397
2396 2398
2397 } // namespace internal 2399 } // namespace internal
2398 } // namespace v8 2400 } // namespace v8
OLDNEW
« src/contexts.cc ('K') | « src/counters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698