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

Side by Side Diff: src/objects.cc

Issue 6973063: Extend GCMole with poor man's data flow analysis to catch dead raw pointer vars. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 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
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 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after
2866 NumberDictionary* dictionary = element_dictionary(); 2866 NumberDictionary* dictionary = element_dictionary();
2867 int entry = dictionary->FindEntry(index); 2867 int entry = dictionary->FindEntry(index);
2868 if (entry != NumberDictionary::kNotFound) { 2868 if (entry != NumberDictionary::kNotFound) {
2869 Object* result = dictionary->DeleteProperty(entry, mode); 2869 Object* result = dictionary->DeleteProperty(entry, mode);
2870 if (mode == STRICT_DELETION && result == 2870 if (mode == STRICT_DELETION && result ==
2871 isolate->heap()->false_value()) { 2871 isolate->heap()->false_value()) {
2872 // In strict mode, deleting a non-configurable property throws 2872 // In strict mode, deleting a non-configurable property throws
2873 // exception. dictionary->DeleteProperty will return false_value() 2873 // exception. dictionary->DeleteProperty will return false_value()
2874 // if a non-configurable property is being deleted. 2874 // if a non-configurable property is being deleted.
2875 HandleScope scope; 2875 HandleScope scope;
2876 Handle<Object> self(this);
2876 Handle<Object> i = isolate->factory()->NewNumberFromUint(index); 2877 Handle<Object> i = isolate->factory()->NewNumberFromUint(index);
2877 Handle<Object> args[2] = { i, Handle<Object>(this) }; 2878 Handle<Object> args[2] = { i, self };
2878 return isolate->Throw(*isolate->factory()->NewTypeError( 2879 return isolate->Throw(*isolate->factory()->NewTypeError(
2879 "strict_delete_property", HandleVector(args, 2))); 2880 "strict_delete_property", HandleVector(args, 2)));
2880 } 2881 }
2881 } 2882 }
2882 break; 2883 break;
2883 } 2884 }
2884 default: 2885 default:
2885 UNREACHABLE(); 2886 UNREACHABLE();
2886 break; 2887 break;
2887 } 2888 }
(...skipping 4397 matching lines...) Expand 10 before | Expand all | Expand 10 after
7285 7286
7286 MaybeObject* JSObject::GetElementWithCallback(Object* receiver, 7287 MaybeObject* JSObject::GetElementWithCallback(Object* receiver,
7287 Object* structure, 7288 Object* structure,
7288 uint32_t index, 7289 uint32_t index,
7289 Object* holder) { 7290 Object* holder) {
7290 Isolate* isolate = GetIsolate(); 7291 Isolate* isolate = GetIsolate();
7291 ASSERT(!structure->IsProxy()); 7292 ASSERT(!structure->IsProxy());
7292 7293
7293 // api style callbacks. 7294 // api style callbacks.
7294 if (structure->IsAccessorInfo()) { 7295 if (structure->IsAccessorInfo()) {
7295 AccessorInfo* data = AccessorInfo::cast(structure); 7296 Handle<AccessorInfo> data(AccessorInfo::cast(structure));
7296 Object* fun_obj = data->getter(); 7297 Object* fun_obj = data->getter();
7297 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); 7298 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj);
7298 HandleScope scope(isolate); 7299 HandleScope scope(isolate);
7299 Handle<JSObject> self(JSObject::cast(receiver)); 7300 Handle<JSObject> self(JSObject::cast(receiver));
7300 Handle<JSObject> holder_handle(JSObject::cast(holder)); 7301 Handle<JSObject> holder_handle(JSObject::cast(holder));
7301 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 7302 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
7302 Handle<String> key(isolate->factory()->NumberToString(number)); 7303 Handle<String> key(isolate->factory()->NumberToString(number));
7303 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key)); 7304 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key));
7304 CustomArguments args(isolate, data->data(), *self, *holder_handle); 7305 CustomArguments args(isolate, data->data(), *self, *holder_handle);
7305 v8::AccessorInfo info(args.end()); 7306 v8::AccessorInfo info(args.end());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
7342 ASSERT(!value->IsTheHole()); 7343 ASSERT(!value->IsTheHole());
7343 Handle<Object> value_handle(value, isolate); 7344 Handle<Object> value_handle(value, isolate);
7344 7345
7345 // To accommodate both the old and the new api we switch on the 7346 // To accommodate both the old and the new api we switch on the
7346 // data structure used to store the callbacks. Eventually proxy 7347 // data structure used to store the callbacks. Eventually proxy
7347 // callbacks should be phased out. 7348 // callbacks should be phased out.
7348 ASSERT(!structure->IsProxy()); 7349 ASSERT(!structure->IsProxy());
7349 7350
7350 if (structure->IsAccessorInfo()) { 7351 if (structure->IsAccessorInfo()) {
7351 // api style callbacks 7352 // api style callbacks
7352 AccessorInfo* data = AccessorInfo::cast(structure); 7353 Handle<JSObject> self(this);
7354 Handle<JSObject> holder_handle(JSObject::cast(holder));
7355 Handle<AccessorInfo> data(AccessorInfo::cast(structure));
7353 Object* call_obj = data->setter(); 7356 Object* call_obj = data->setter();
7354 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj); 7357 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj);
7355 if (call_fun == NULL) return value; 7358 if (call_fun == NULL) return value;
7356 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 7359 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
7357 Handle<String> key(isolate->factory()->NumberToString(number)); 7360 Handle<String> key(isolate->factory()->NumberToString(number));
7358 LOG(isolate, ApiNamedPropertyAccess("store", this, *key)); 7361 LOG(isolate, ApiNamedPropertyAccess("store", *self, *key));
7359 CustomArguments args(isolate, data->data(), this, JSObject::cast(holder)); 7362 CustomArguments args(isolate, data->data(), *self, *holder_handle);
7360 v8::AccessorInfo info(args.end()); 7363 v8::AccessorInfo info(args.end());
7361 { 7364 {
7362 // Leaving JavaScript. 7365 // Leaving JavaScript.
7363 VMState state(isolate, EXTERNAL); 7366 VMState state(isolate, EXTERNAL);
7364 call_fun(v8::Utils::ToLocal(key), 7367 call_fun(v8::Utils::ToLocal(key),
7365 v8::Utils::ToLocal(value_handle), 7368 v8::Utils::ToLocal(value_handle),
7366 info); 7369 info);
7367 } 7370 }
7368 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 7371 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
7369 return *value_handle; 7372 return *value_handle;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
7551 if (entry != NumberDictionary::kNotFound) { 7554 if (entry != NumberDictionary::kNotFound) {
7552 Object* element = dictionary->ValueAt(entry); 7555 Object* element = dictionary->ValueAt(entry);
7553 PropertyDetails details = dictionary->DetailsAt(entry); 7556 PropertyDetails details = dictionary->DetailsAt(entry);
7554 if (details.type() == CALLBACKS) { 7557 if (details.type() == CALLBACKS) {
7555 return SetElementWithCallback(element, index, value, this); 7558 return SetElementWithCallback(element, index, value, this);
7556 } else { 7559 } else {
7557 dictionary->UpdateMaxNumberKey(index); 7560 dictionary->UpdateMaxNumberKey(index);
7558 // If put fails instrict mode, throw exception. 7561 // If put fails instrict mode, throw exception.
7559 if (!dictionary->ValueAtPut(entry, value) && 7562 if (!dictionary->ValueAtPut(entry, value) &&
7560 strict_mode == kStrictMode) { 7563 strict_mode == kStrictMode) {
7564 Handle<Object> holder(this);
7561 Handle<Object> number(isolate->factory()->NewNumberFromUint(index)); 7565 Handle<Object> number(isolate->factory()->NewNumberFromUint(index));
7562 Handle<Object> holder(this);
7563 Handle<Object> args[2] = { number, holder }; 7566 Handle<Object> args[2] = { number, holder };
7564 return isolate->Throw( 7567 return isolate->Throw(
7565 *isolate->factory()->NewTypeError("strict_read_only_property", 7568 *isolate->factory()->NewTypeError("strict_read_only_property",
7566 HandleVector(args, 2))); 7569 HandleVector(args, 2)));
7567 } 7570 }
7568 } 7571 }
7569 } else { 7572 } else {
7570 // Index not already used. Look for an accessor in the prototype chain. 7573 // Index not already used. Look for an accessor in the prototype chain.
7571 if (check_prototype) { 7574 if (check_prototype) {
7572 bool found; 7575 bool found;
(...skipping 2854 matching lines...) Expand 10 before | Expand all | Expand 10 after
10427 if (break_point_objects()->IsUndefined()) return 0; 10430 if (break_point_objects()->IsUndefined()) return 0;
10428 // Single beak point. 10431 // Single beak point.
10429 if (!break_point_objects()->IsFixedArray()) return 1; 10432 if (!break_point_objects()->IsFixedArray()) return 1;
10430 // Multiple break points. 10433 // Multiple break points.
10431 return FixedArray::cast(break_point_objects())->length(); 10434 return FixedArray::cast(break_point_objects())->length();
10432 } 10435 }
10433 #endif 10436 #endif
10434 10437
10435 10438
10436 } } // namespace v8::internal 10439 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698