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

Side by Side Diff: src/runtime.cc

Issue 3274008: Get gcc to check that we don't ignore return values of functions that can... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | src/stub-cache.h » ('j') | src/utils.h » ('J')
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // a variable of the specified type with the given name. If the 91 // a variable of the specified type with the given name. If the
92 // object is not a Number call IllegalOperation and return. 92 // object is not a Number call IllegalOperation and return.
93 #define CONVERT_NUMBER_CHECKED(type, name, Type, obj) \ 93 #define CONVERT_NUMBER_CHECKED(type, name, Type, obj) \
94 RUNTIME_ASSERT(obj->IsNumber()); \ 94 RUNTIME_ASSERT(obj->IsNumber()); \
95 type name = NumberTo##Type(obj); 95 type name = NumberTo##Type(obj);
96 96
97 // Non-reentrant string buffer for efficient general use in this file. 97 // Non-reentrant string buffer for efficient general use in this file.
98 static StaticResource<StringInputBuffer> runtime_string_input_buffer; 98 static StaticResource<StringInputBuffer> runtime_string_input_buffer;
99 99
100 100
101 static Object* DeepCopyBoilerplate(JSObject* boilerplate) { 101 NOIGNORE static Object* DeepCopyBoilerplate(JSObject* boilerplate) {
102 StackLimitCheck check; 102 StackLimitCheck check;
103 if (check.HasOverflowed()) return Top::StackOverflow(); 103 if (check.HasOverflowed()) return Top::StackOverflow();
104 104
105 Object* result = Heap::CopyJSObject(boilerplate); 105 Object* result = Heap::CopyJSObject(boilerplate);
106 if (result->IsFailure()) return result; 106 if (result->IsFailure()) return result;
107 JSObject* copy = JSObject::cast(result); 107 JSObject* copy = JSObject::cast(result);
108 108
109 // Deep copy local properties. 109 // Deep copy local properties.
110 if (copy->HasFastProperties()) { 110 if (copy->HasFastProperties()) {
111 FixedArray* properties = copy->properties(); 111 FixedArray* properties = copy->properties();
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 if (index >= 0) { 973 if (index >= 0) {
974 // The variable or constant context slot should always be in 974 // The variable or constant context slot should always be in
975 // the function context or the arguments object. 975 // the function context or the arguments object.
976 if (holder->IsContext()) { 976 if (holder->IsContext()) {
977 ASSERT(holder.is_identical_to(context)); 977 ASSERT(holder.is_identical_to(context));
978 if (((attributes & READ_ONLY) == 0) || 978 if (((attributes & READ_ONLY) == 0) ||
979 context->get(index)->IsTheHole()) { 979 context->get(index)->IsTheHole()) {
980 context->set(index, *initial_value); 980 context->set(index, *initial_value);
981 } 981 }
982 } else { 982 } else {
983 Handle<JSObject>::cast(holder)->SetElement(index, *initial_value); 983 // The holder is an arguments object.
984 Handle<JSObject> arguments(Handle<JSObject>::cast(holder));
985 SetElement(arguments, index, initial_value);
984 } 986 }
985 } else { 987 } else {
986 // Slow case: The property is not in the FixedArray part of the context. 988 // Slow case: The property is not in the FixedArray part of the context.
987 Handle<JSObject> context_ext = Handle<JSObject>::cast(holder); 989 Handle<JSObject> context_ext = Handle<JSObject>::cast(holder);
988 SetProperty(context_ext, name, initial_value, mode); 990 SetProperty(context_ext, name, initial_value, mode);
989 } 991 }
990 } 992 }
991 993
992 } else { 994 } else {
993 // The property is not in the function context. It needs to be 995 // The property is not in the function context. It needs to be
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 // The holder cannot be the function context. If it is, there 1233 // The holder cannot be the function context. If it is, there
1232 // should have been a const redeclaration error when declaring 1234 // should have been a const redeclaration error when declaring
1233 // the const property. 1235 // the const property.
1234 ASSERT(!holder.is_identical_to(context)); 1236 ASSERT(!holder.is_identical_to(context));
1235 if ((attributes & READ_ONLY) == 0) { 1237 if ((attributes & READ_ONLY) == 0) {
1236 Handle<Context>::cast(holder)->set(index, *value); 1238 Handle<Context>::cast(holder)->set(index, *value);
1237 } 1239 }
1238 } else { 1240 } else {
1239 // The holder is an arguments object. 1241 // The holder is an arguments object.
1240 ASSERT((attributes & READ_ONLY) == 0); 1242 ASSERT((attributes & READ_ONLY) == 0);
1241 Handle<JSObject>::cast(holder)->SetElement(index, *value); 1243 Handle<JSObject> arguments(Handle<JSObject>::cast(holder));
1244 SetElement(arguments, index, value);
1242 } 1245 }
1243 return *value; 1246 return *value;
1244 } 1247 }
1245 1248
1246 // The property could not be found, we introduce it in the global 1249 // The property could not be found, we introduce it in the global
1247 // context. 1250 // context.
1248 if (attributes == ABSENT) { 1251 if (attributes == ABSENT) {
1249 Handle<JSObject> global = Handle<JSObject>(Top::context()->global()); 1252 Handle<JSObject> global = Handle<JSObject>(Top::context()->global());
1250 SetProperty(global, name, value, NONE); 1253 SetProperty(global, name, value, NONE);
1251 return *value; 1254 return *value;
(...skipping 2846 matching lines...) Expand 10 before | Expand all | Expand 10 after
4098 LookupResult result; 4101 LookupResult result;
4099 obj->LocalLookupRealNamedProperty(name, &result); 4102 obj->LocalLookupRealNamedProperty(name, &result);
4100 4103
4101 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked); 4104 PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
4102 // If an existing property is either FIELD, NORMAL or CONSTANT_FUNCTION 4105 // If an existing property is either FIELD, NORMAL or CONSTANT_FUNCTION
4103 // delete it to avoid running into trouble in DefineAccessor, which 4106 // delete it to avoid running into trouble in DefineAccessor, which
4104 // handles this incorrectly if the property is readonly (does nothing) 4107 // handles this incorrectly if the property is readonly (does nothing)
4105 if (result.IsProperty() && 4108 if (result.IsProperty() &&
4106 (result.type() == FIELD || result.type() == NORMAL 4109 (result.type() == FIELD || result.type() == NORMAL
4107 || result.type() == CONSTANT_FUNCTION)) { 4110 || result.type() == CONSTANT_FUNCTION)) {
4108 obj->DeleteProperty(name, JSObject::NORMAL_DELETION); 4111 Object* ok = obj->DeleteProperty(name, JSObject::NORMAL_DELETION);
4112 if (ok->IsFailure()) return ok;
4109 } 4113 }
4110 return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr); 4114 return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr);
4111 } 4115 }
4112 4116
4113 static Object* Runtime_DefineOrRedefineDataProperty(Arguments args) { 4117 static Object* Runtime_DefineOrRedefineDataProperty(Arguments args) {
4114 ASSERT(args.length() == 4); 4118 ASSERT(args.length() == 4);
4115 HandleScope scope; 4119 HandleScope scope;
4116 CONVERT_ARG_CHECKED(JSObject, js_object, 0); 4120 CONVERT_ARG_CHECKED(JSObject, js_object, 0);
4117 CONVERT_ARG_CHECKED(String, name, 1); 4121 CONVERT_ARG_CHECKED(String, name, 1);
4118 Handle<Object> obj_value = args.at<Object>(2); 4122 Handle<Object> obj_value = args.at<Object>(2);
(...skipping 6620 matching lines...) Expand 10 before | Expand all | Expand 10 after
10739 } else { 10743 } else {
10740 // Handle last resort GC and make sure to allow future allocations 10744 // Handle last resort GC and make sure to allow future allocations
10741 // to grow the heap without causing GCs (if possible). 10745 // to grow the heap without causing GCs (if possible).
10742 Counters::gc_last_resort_from_js.Increment(); 10746 Counters::gc_last_resort_from_js.Increment();
10743 Heap::CollectAllGarbage(false); 10747 Heap::CollectAllGarbage(false);
10744 } 10748 }
10745 } 10749 }
10746 10750
10747 10751
10748 } } // namespace v8::internal 10752 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/stub-cache.h » ('j') | src/utils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698