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

Side by Side Diff: src/runtime.cc

Issue 3411013: Make some runtime arguments checks be RUNTIME_ASSERT, not ASSERT. (Closed)
Patch Set: Address review comments. Remove fuzz-exception. Created 10 years, 3 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 | « no previous file | test/mjsunit/fuzz-natives.js » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 939
940 940
941 static Object* Runtime_DeclareContextSlot(Arguments args) { 941 static Object* Runtime_DeclareContextSlot(Arguments args) {
942 HandleScope scope; 942 HandleScope scope;
943 ASSERT(args.length() == 4); 943 ASSERT(args.length() == 4);
944 944
945 CONVERT_ARG_CHECKED(Context, context, 0); 945 CONVERT_ARG_CHECKED(Context, context, 0);
946 Handle<String> name(String::cast(args[1])); 946 Handle<String> name(String::cast(args[1]));
947 PropertyAttributes mode = 947 PropertyAttributes mode =
948 static_cast<PropertyAttributes>(Smi::cast(args[2])->value()); 948 static_cast<PropertyAttributes>(Smi::cast(args[2])->value());
949 ASSERT(mode == READ_ONLY || mode == NONE); 949 RUNTIME_ASSERT(mode == READ_ONLY || mode == NONE);
950 Handle<Object> initial_value(args[3]); 950 Handle<Object> initial_value(args[3]);
951 951
952 // Declarations are always done in the function context. 952 // Declarations are always done in the function context.
953 context = Handle<Context>(context->fcontext()); 953 context = Handle<Context>(context->fcontext());
954 954
955 int index; 955 int index;
956 PropertyAttributes attributes; 956 PropertyAttributes attributes;
957 ContextLookupFlags flags = DONT_FOLLOW_CHAINS; 957 ContextLookupFlags flags = DONT_FOLLOW_CHAINS;
958 Handle<Object> holder = 958 Handle<Object> holder =
959 context->Lookup(name, flags, &index, &attributes); 959 context->Lookup(name, flags, &index, &attributes);
(...skipping 7977 matching lines...) Expand 10 before | Expand all | Expand 10 after
8937 ASSERT(args.length() == 1); 8937 ASSERT(args.length() == 1);
8938 Handle<Object> break_point_object_arg = args.at<Object>(0); 8938 Handle<Object> break_point_object_arg = args.at<Object>(0);
8939 8939
8940 // Clear break point. 8940 // Clear break point.
8941 Debug::ClearBreakPoint(break_point_object_arg); 8941 Debug::ClearBreakPoint(break_point_object_arg);
8942 8942
8943 return Heap::undefined_value(); 8943 return Heap::undefined_value();
8944 } 8944 }
8945 8945
8946 8946
8947 // Change the state of break on exceptions 8947 // Change the state of break on exceptions.
8948 // args[0]: boolean indicating uncaught exceptions 8948 // args[0]: Enum value indicating whether to affect caught/uncaught exceptions.
8949 // args[1]: boolean indicating on/off 8949 // args[1]: Boolean indicating on/off.
8950 static Object* Runtime_ChangeBreakOnException(Arguments args) { 8950 static Object* Runtime_ChangeBreakOnException(Arguments args) {
8951 HandleScope scope; 8951 HandleScope scope;
8952 ASSERT(args.length() == 2); 8952 ASSERT(args.length() == 2);
8953 ASSERT(args[0]->IsNumber()); 8953 RUNTIME_ASSERT(args[0]->IsNumber());
8954 ASSERT(args[1]->IsBoolean()); 8954 CONVERT_BOOLEAN_CHECKED(enable, args[1]);
8955 8955
8956 // Update break point state 8956 // If the number doesn't match an enum value, the ChangeBreakOnException
8957 // function will default to affecting caught exceptions.
8957 ExceptionBreakType type = 8958 ExceptionBreakType type =
8958 static_cast<ExceptionBreakType>(NumberToUint32(args[0])); 8959 static_cast<ExceptionBreakType>(NumberToUint32(args[0]));
8959 bool enable = args[1]->ToBoolean()->IsTrue(); 8960 // Update break point state.
8960 Debug::ChangeBreakOnException(type, enable); 8961 Debug::ChangeBreakOnException(type, enable);
8961 return Heap::undefined_value(); 8962 return Heap::undefined_value();
8962 } 8963 }
8963 8964
8964 8965
8965 // Returns the state of break on exceptions 8966 // Returns the state of break on exceptions
8966 // args[0]: boolean indicating uncaught exceptions 8967 // args[0]: boolean indicating uncaught exceptions
8967 static Object* Runtime_IsBreakOnException(Arguments args) { 8968 static Object* Runtime_IsBreakOnException(Arguments args) {
8968 HandleScope scope; 8969 HandleScope scope;
8969 ASSERT(args.length() == 1); 8970 ASSERT(args.length() == 1);
8970 ASSERT(args[0]->IsNumber()); 8971 RUNTIME_ASSERT(args[0]->IsNumber());
8971 8972
8972 ExceptionBreakType type = 8973 ExceptionBreakType type =
8973 static_cast<ExceptionBreakType>(NumberToUint32(args[0])); 8974 static_cast<ExceptionBreakType>(NumberToUint32(args[0]));
8974 bool result = Debug::IsBreakOnException(type); 8975 bool result = Debug::IsBreakOnException(type);
8975 return Smi::FromInt(result); 8976 return Smi::FromInt(result);
8976 } 8977 }
8977 8978
8978 8979
8979 // Prepare for stepping 8980 // Prepare for stepping
8980 // args[0]: break id for checking execution state 8981 // args[0]: break id for checking execution state
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
10162 } else { 10163 } else {
10163 // Handle last resort GC and make sure to allow future allocations 10164 // Handle last resort GC and make sure to allow future allocations
10164 // to grow the heap without causing GCs (if possible). 10165 // to grow the heap without causing GCs (if possible).
10165 Counters::gc_last_resort_from_js.Increment(); 10166 Counters::gc_last_resort_from_js.Increment();
10166 Heap::CollectAllGarbage(false); 10167 Heap::CollectAllGarbage(false);
10167 } 10168 }
10168 } 10169 }
10169 10170
10170 10171
10171 } } // namespace v8::internal 10172 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/fuzz-natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698