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

Side by Side Diff: src/runtime.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 7910 matching lines...) Expand 10 before | Expand all | Expand 10 after
7921 ContextLookupFlags flags = FOLLOW_CHAINS; 7921 ContextLookupFlags flags = FOLLOW_CHAINS;
7922 Handle<Object> holder = context->Lookup(name, flags, &index, &attributes); 7922 Handle<Object> holder = context->Lookup(name, flags, &index, &attributes);
7923 7923
7924 // If the index is non-negative, the slot has been found in a local 7924 // If the index is non-negative, the slot has been found in a local
7925 // variable or a parameter. Read it from the context object or the 7925 // variable or a parameter. Read it from the context object or the
7926 // arguments object. 7926 // arguments object.
7927 if (index >= 0) { 7927 if (index >= 0) {
7928 // If the "property" we were looking for is a local variable or an 7928 // If the "property" we were looking for is a local variable or an
7929 // argument in a context, the receiver is the global object; see 7929 // argument in a context, the receiver is the global object; see
7930 // ECMA-262, 3rd., 10.1.6 and 10.2.3. 7930 // ECMA-262, 3rd., 10.1.6 and 10.2.3.
7931 JSObject* receiver = 7931 // GetElement below can cause GC.
7932 isolate->context()->global()->global_receiver(); 7932 Handle<JSObject> receiver(
7933 isolate->context()->global()->global_receiver());
7933 MaybeObject* value = (holder->IsContext()) 7934 MaybeObject* value = (holder->IsContext())
7934 ? Context::cast(*holder)->get(index) 7935 ? Context::cast(*holder)->get(index)
7935 : JSObject::cast(*holder)->GetElement(index); 7936 : JSObject::cast(*holder)->GetElement(index);
7936 return MakePair(Unhole(isolate->heap(), value, attributes), receiver); 7937 return MakePair(Unhole(isolate->heap(), value, attributes), *receiver);
7937 } 7938 }
7938 7939
7939 // If the holder is found, we read the property from it. 7940 // If the holder is found, we read the property from it.
7940 if (!holder.is_null() && holder->IsJSObject()) { 7941 if (!holder.is_null() && holder->IsJSObject()) {
7941 ASSERT(Handle<JSObject>::cast(holder)->HasProperty(*name)); 7942 ASSERT(Handle<JSObject>::cast(holder)->HasProperty(*name));
7942 JSObject* object = JSObject::cast(*holder); 7943 JSObject* object = JSObject::cast(*holder);
7943 JSObject* receiver; 7944 JSObject* receiver;
7944 if (object->IsGlobalObject()) { 7945 if (object->IsGlobalObject()) {
7945 receiver = GlobalObject::cast(object)->global_receiver(); 7946 receiver = GlobalObject::cast(object)->global_receiver();
7946 } else if (context->is_exception_holder(*holder)) { 7947 } else if (context->is_exception_holder(*holder)) {
7947 receiver = isolate->context()->global()->global_receiver(); 7948 receiver = isolate->context()->global()->global_receiver();
7948 } else { 7949 } else {
7949 receiver = ComputeReceiverForNonGlobal(isolate, object); 7950 receiver = ComputeReceiverForNonGlobal(isolate, object);
7950 } 7951 }
7952
7953 // GetProperty below can cause GC.
7954 Handle<JSObject> receiver_handle(receiver);
7955
7951 // No need to unhole the value here. This is taken care of by the 7956 // No need to unhole the value here. This is taken care of by the
7952 // GetProperty function. 7957 // GetProperty function.
7953 MaybeObject* value = object->GetProperty(*name); 7958 MaybeObject* value = object->GetProperty(*name);
7954 return MakePair(value, receiver); 7959 return MakePair(value, *receiver_handle);
7955 } 7960 }
7956 7961
7957 if (throw_error) { 7962 if (throw_error) {
7958 // The property doesn't exist - throw exception. 7963 // The property doesn't exist - throw exception.
7959 Handle<Object> reference_error = 7964 Handle<Object> reference_error =
7960 isolate->factory()->NewReferenceError("not_defined", 7965 isolate->factory()->NewReferenceError("not_defined",
7961 HandleVector(&name, 1)); 7966 HandleVector(&name, 1));
7962 return MakePair(isolate->Throw(*reference_error), NULL); 7967 return MakePair(isolate->Throw(*reference_error), NULL);
7963 } else { 7968 } else {
7964 // The property doesn't exist - return undefined 7969 // The property doesn't exist - return undefined
(...skipping 4245 matching lines...) Expand 10 before | Expand all | Expand 10 after
12210 } else { 12215 } else {
12211 // Handle last resort GC and make sure to allow future allocations 12216 // Handle last resort GC and make sure to allow future allocations
12212 // to grow the heap without causing GCs (if possible). 12217 // to grow the heap without causing GCs (if possible).
12213 isolate->counters()->gc_last_resort_from_js()->Increment(); 12218 isolate->counters()->gc_last_resort_from_js()->Increment();
12214 isolate->heap()->CollectAllGarbage(false); 12219 isolate->heap()->CollectAllGarbage(false);
12215 } 12220 }
12216 } 12221 }
12217 12222
12218 12223
12219 } } // namespace v8::internal 12224 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698