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

Side by Side Diff: src/objects.cc

Issue 15743005: Fix corner case in optimized code map zapping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
« no previous file with comments | « src/objects.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 9025 matching lines...) Expand 10 before | Expand all | Expand 10 after
9036 FixedArray* old_code_map = FixedArray::cast(value); 9036 FixedArray* old_code_map = FixedArray::cast(value);
9037 ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context)); 9037 ASSERT_EQ(-1, SearchOptimizedCodeMap(native_context));
9038 int old_length = old_code_map->length(); 9038 int old_length = old_code_map->length();
9039 int new_length = old_length + kEntryLength; 9039 int new_length = old_length + kEntryLength;
9040 MaybeObject* maybe = old_code_map->CopySize(new_length); 9040 MaybeObject* maybe = old_code_map->CopySize(new_length);
9041 if (!maybe->To(&new_code_map)) return maybe; 9041 if (!maybe->To(&new_code_map)) return maybe;
9042 new_code_map->set(old_length + 0, native_context); 9042 new_code_map->set(old_length + 0, native_context);
9043 new_code_map->set(old_length + 1, code); 9043 new_code_map->set(old_length + 1, code);
9044 new_code_map->set(old_length + 2, literals); 9044 new_code_map->set(old_length + 2, literals);
9045 // Zap the old map for the sake of the heap verifier. 9045 // Zap the old map for the sake of the heap verifier.
9046 if (Heap::ShouldZapGarbage()) ZapOptimizedCodeMap(); 9046 if (Heap::ShouldZapGarbage()) {
9047 Object** data = old_code_map->data_start();
9048 MemsetPointer(data, heap->the_hole_value(), old_length);
9049 }
9047 } 9050 }
9048 #ifdef DEBUG 9051 #ifdef DEBUG
9049 for (int i = kEntriesStart; i < new_code_map->length(); i += kEntryLength) { 9052 for (int i = kEntriesStart; i < new_code_map->length(); i += kEntryLength) {
9050 ASSERT(new_code_map->get(i)->IsNativeContext()); 9053 ASSERT(new_code_map->get(i)->IsNativeContext());
9051 ASSERT(new_code_map->get(i + 1)->IsCode()); 9054 ASSERT(new_code_map->get(i + 1)->IsCode());
9052 ASSERT(Code::cast(new_code_map->get(i + 1))->kind() == 9055 ASSERT(Code::cast(new_code_map->get(i + 1))->kind() ==
9053 Code::OPTIMIZED_FUNCTION); 9056 Code::OPTIMIZED_FUNCTION);
9054 ASSERT(new_code_map->get(i + 2)->IsFixedArray()); 9057 ASSERT(new_code_map->get(i + 2)->IsFixedArray());
9055 } 9058 }
9056 #endif 9059 #endif
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
9130 ASSERT(shrink_by % kEntryLength == 0); 9133 ASSERT(shrink_by % kEntryLength == 0);
9131 ASSERT(shrink_by <= code_map->length() - kEntriesStart); 9134 ASSERT(shrink_by <= code_map->length() - kEntriesStart);
9132 // Always trim even when array is cleared because of heap verifier. 9135 // Always trim even when array is cleared because of heap verifier.
9133 RightTrimFixedArray<FROM_GC>(GetHeap(), code_map, shrink_by); 9136 RightTrimFixedArray<FROM_GC>(GetHeap(), code_map, shrink_by);
9134 if (code_map->length() == kEntriesStart) { 9137 if (code_map->length() == kEntriesStart) {
9135 ClearOptimizedCodeMap(); 9138 ClearOptimizedCodeMap();
9136 } 9139 }
9137 } 9140 }
9138 9141
9139 9142
9140 void SharedFunctionInfo::ZapOptimizedCodeMap() {
9141 FixedArray* code_map = FixedArray::cast(optimized_code_map());
9142 MemsetPointer(code_map->data_start(),
9143 GetHeap()->the_hole_value(),
9144 code_map->length());
9145 }
9146
9147
9148 bool JSFunction::CompileLazy(Handle<JSFunction> function, 9143 bool JSFunction::CompileLazy(Handle<JSFunction> function,
9149 ClearExceptionFlag flag) { 9144 ClearExceptionFlag flag) {
9150 bool result = true; 9145 bool result = true;
9151 if (function->shared()->is_compiled()) { 9146 if (function->shared()->is_compiled()) {
9152 function->ReplaceCode(function->shared()->code()); 9147 function->ReplaceCode(function->shared()->code());
9153 function->shared()->set_code_age(0); 9148 function->shared()->set_code_age(0);
9154 } else { 9149 } else {
9155 ASSERT(function->shared()->allows_lazy_compilation()); 9150 ASSERT(function->shared()->allows_lazy_compilation());
9156 CompilationInfoWithZone info(function); 9151 CompilationInfoWithZone info(function);
9157 result = CompileLazyHelper(&info, flag); 9152 result = CompileLazyHelper(&info, flag);
(...skipping 6301 matching lines...) Expand 10 before | Expand all | Expand 10 after
15459 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 15454 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
15460 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 15455 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
15461 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 15456 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
15462 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 15457 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
15463 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 15458 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
15464 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 15459 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
15465 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 15460 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
15466 } 15461 }
15467 15462
15468 } } // namespace v8::internal 15463 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698