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

Unified Diff: src/objects.cc

Issue 298983002: ClearTypeFeedbackInfo(): context may not be initialized. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index a1b03eef63d44897d8ad59fd35e7ea5d0f18fa3a..ddeaacd6b44011e6bd1cfd8ee12e377fa154adc7 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11245,10 +11245,19 @@ void Code::ClearInlineCaches(Code::Kind* kind) {
void SharedFunctionInfo::ClearTypeFeedbackInfo() {
FixedArray* vector = feedback_vector();
Heap* heap = GetHeap();
+ JSFunction* array_function = NULL;
+
+ // Clearing type feedback can be called when the contexts are still being
+ // set up so caution is required.
Context* context = GetIsolate()->context();
- JSFunction* array_function = context != NULL
- ? context->native_context()->array_function()
- : NULL;
+ if (context != NULL) {
+ Context* native_context = context->native_context();
+ Object* candidate = native_context->get(Context::ARRAY_FUNCTION_INDEX);
+ if (candidate->IsJSFunction()) {
+ array_function = JSFunction::cast(candidate);
+ }
+ }
+
int length = vector->length();
for (int i = 0; i < length; i++) {
« 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