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

Side by Side Diff: src/objects.cc

Issue 7247013: Fix three GC unsafe places found by gcmole's dead_vars analysis. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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 | « no previous file | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2226 2226
2227 // Call trap function. 2227 // Call trap function.
2228 Object** args[] = { 2228 Object** args[] = {
2229 receiver.location(), name.location(), value.location() 2229 receiver.location(), name.location(), value.location()
2230 }; 2230 };
2231 bool has_exception; 2231 bool has_exception;
2232 Handle<Object> result = 2232 Handle<Object> result =
2233 Execution::Call(trap, handler, ARRAY_SIZE(args), args, &has_exception); 2233 Execution::Call(trap, handler, ARRAY_SIZE(args), args, &has_exception);
2234 if (has_exception) return Failure::Exception(); 2234 if (has_exception) return Failure::Exception();
2235 2235
2236 return value_raw; 2236 return *value;
2237 } 2237 }
2238 2238
2239 2239
2240 MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler( 2240 MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
2241 JSReceiver* receiver_raw, 2241 JSReceiver* receiver_raw,
2242 String* name_raw, 2242 String* name_raw,
2243 bool* has_exception) { 2243 bool* has_exception) {
2244 Isolate* isolate = GetIsolate(); 2244 Isolate* isolate = GetIsolate();
2245 HandleScope scope; 2245 HandleScope scope;
2246 Handle<JSReceiver> receiver(receiver_raw); 2246 Handle<JSReceiver> receiver(receiver_raw);
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
3058 FixedArray* new_elements = NULL; 3058 FixedArray* new_elements = NULL;
3059 if (!maybe_elements->To(&new_elements)) { 3059 if (!maybe_elements->To(&new_elements)) {
3060 return maybe_elements; 3060 return maybe_elements;
3061 } 3061 }
3062 set_elements(new_elements); 3062 set_elements(new_elements);
3063 } 3063 }
3064 if (mode == STRICT_DELETION && result == heap->false_value()) { 3064 if (mode == STRICT_DELETION && result == heap->false_value()) {
3065 // In strict mode, attempting to delete a non-configurable property 3065 // In strict mode, attempting to delete a non-configurable property
3066 // throws an exception. 3066 // throws an exception.
3067 HandleScope scope(isolate); 3067 HandleScope scope(isolate);
3068 Handle<Object> holder(this);
3068 Handle<Object> name = isolate->factory()->NewNumberFromUint(index); 3069 Handle<Object> name = isolate->factory()->NewNumberFromUint(index);
3069 Handle<Object> args[2] = { name, Handle<Object>(this) }; 3070 Handle<Object> args[2] = { name, holder };
3070 Handle<Object> error = 3071 Handle<Object> error =
3071 isolate->factory()->NewTypeError("strict_delete_property", 3072 isolate->factory()->NewTypeError("strict_delete_property",
3072 HandleVector(args, 2)); 3073 HandleVector(args, 2));
3073 return isolate->Throw(*error); 3074 return isolate->Throw(*error);
3074 } 3075 }
3075 } 3076 }
3076 return heap->true_value(); 3077 return heap->true_value();
3077 } 3078 }
3078 3079
3079 3080
(...skipping 5247 matching lines...) Expand 10 before | Expand all | Expand 10 after
8327 int entry = dictionary->FindEntry(index); 8328 int entry = dictionary->FindEntry(index);
8328 if (entry != NumberDictionary::kNotFound) { 8329 if (entry != NumberDictionary::kNotFound) {
8329 Object* element = dictionary->ValueAt(entry); 8330 Object* element = dictionary->ValueAt(entry);
8330 PropertyDetails details = dictionary->DetailsAt(entry); 8331 PropertyDetails details = dictionary->DetailsAt(entry);
8331 if (details.type() == CALLBACKS) { 8332 if (details.type() == CALLBACKS) {
8332 return SetElementWithCallback(element, index, value, this, strict_mode); 8333 return SetElementWithCallback(element, index, value, this, strict_mode);
8333 } else { 8334 } else {
8334 dictionary->UpdateMaxNumberKey(index); 8335 dictionary->UpdateMaxNumberKey(index);
8335 // If put fails in strict mode, throw an exception. 8336 // If put fails in strict mode, throw an exception.
8336 if (!dictionary->ValueAtPut(entry, value) && strict_mode == kStrictMode) { 8337 if (!dictionary->ValueAtPut(entry, value) && strict_mode == kStrictMode) {
8338 Handle<Object> holder(this);
8337 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 8339 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
8338 Handle<Object> holder(this);
8339 Handle<Object> args[2] = { number, holder }; 8340 Handle<Object> args[2] = { number, holder };
8340 Handle<Object> error = 8341 Handle<Object> error =
8341 isolate->factory()->NewTypeError("strict_read_only_property", 8342 isolate->factory()->NewTypeError("strict_read_only_property",
8342 HandleVector(args, 2)); 8343 HandleVector(args, 2));
8343 return isolate->Throw(*error); 8344 return isolate->Throw(*error);
8344 } 8345 }
8345 } 8346 }
8346 } else { 8347 } else {
8347 // Index not already used. Look for an accessor in the prototype chain. 8348 // Index not already used. Look for an accessor in the prototype chain.
8348 if (check_prototype) { 8349 if (check_prototype) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
8434 // If the value object is not a heap number, switch to fast elements and try 8435 // If the value object is not a heap number, switch to fast elements and try
8435 // again. 8436 // again.
8436 bool value_is_smi = value->IsSmi(); 8437 bool value_is_smi = value->IsSmi();
8437 if (!value->IsNumber()) { 8438 if (!value->IsNumber()) {
8438 Object* obj; 8439 Object* obj;
8439 uint32_t length = elms_length; 8440 uint32_t length = elms_length;
8440 if (IsJSArray()) { 8441 if (IsJSArray()) {
8441 CHECK(JSArray::cast(this)->length()->ToArrayIndex(&length)); 8442 CHECK(JSArray::cast(this)->length()->ToArrayIndex(&length));
8442 } 8443 }
8443 MaybeObject* maybe_obj = 8444 MaybeObject* maybe_obj =
8444 SetFastElementsCapacityAndLength(elms_length, length); 8445 SetFastElementsCapacityAndLength(elms_length, length);
Rico 2011/06/23 19:32:02 Shouldn't value be in an handle here, SetFastEleme
Mads Ager (chromium) 2011/06/23 19:49:30 SetFastElementsCapacityAndLength does allocate, bu
8445 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 8446 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
8446 return SetFastElement(index, value, strict_mode, check_prototype); 8447 return SetFastElement(index, value, strict_mode, check_prototype);
8447 } 8448 }
8448 8449
8449 double double_value = value_is_smi 8450 double double_value = value_is_smi
8450 ? static_cast<double>(Smi::cast(value)->value()) 8451 ? static_cast<double>(Smi::cast(value)->value())
8451 : HeapNumber::cast(value)->value(); 8452 : HeapNumber::cast(value)->value();
8452 8453
8453 // Check whether there is extra space in the fixed array. 8454 // Check whether there is extra space in the fixed array.
8454 if (index < elms_length) { 8455 if (index < elms_length) {
(...skipping 3194 matching lines...) Expand 10 before | Expand all | Expand 10 after
11649 if (break_point_objects()->IsUndefined()) return 0; 11650 if (break_point_objects()->IsUndefined()) return 0;
11650 // Single beak point. 11651 // Single beak point.
11651 if (!break_point_objects()->IsFixedArray()) return 1; 11652 if (!break_point_objects()->IsFixedArray()) return 1;
11652 // Multiple break points. 11653 // Multiple break points.
11653 return FixedArray::cast(break_point_objects())->length(); 11654 return FixedArray::cast(break_point_objects())->length();
11654 } 11655 }
11655 #endif 11656 #endif
11656 11657
11657 11658
11658 } } // namespace v8::internal 11659 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698