OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 10139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10150 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); | 10150 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); |
10151 Handle<Object> value(shared->optimized_code_map(), isolate); | 10151 Handle<Object> value(shared->optimized_code_map(), isolate); |
10152 if (value->IsSmi()) return; // Empty code maps are unsupported. | 10152 if (value->IsSmi()) return; // Empty code maps are unsupported. |
10153 Handle<FixedArray> code_map = Handle<FixedArray>::cast(value); | 10153 Handle<FixedArray> code_map = Handle<FixedArray>::cast(value); |
10154 code_map->set(kSharedCodeIndex, *code); | 10154 code_map->set(kSharedCodeIndex, *code); |
10155 } | 10155 } |
10156 | 10156 |
10157 | 10157 |
10158 void SharedFunctionInfo::AddToOptimizedCodeMap( | 10158 void SharedFunctionInfo::AddToOptimizedCodeMap( |
10159 Handle<SharedFunctionInfo> shared, Handle<Context> native_context, | 10159 Handle<SharedFunctionInfo> shared, Handle<Context> native_context, |
10160 Handle<HeapObject> code, Handle<FixedArray> literals, | 10160 Handle<HeapObject> code, Handle<LiteralsArray> literals, |
10161 BailoutId osr_ast_id) { | 10161 BailoutId osr_ast_id) { |
10162 Isolate* isolate = shared->GetIsolate(); | 10162 Isolate* isolate = shared->GetIsolate(); |
10163 DCHECK(*code == isolate->heap()->undefined_value() || | 10163 DCHECK(*code == isolate->heap()->undefined_value() || |
10164 !shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code); | 10164 !shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code); |
10165 DCHECK(*code == isolate->heap()->undefined_value() || | 10165 DCHECK(*code == isolate->heap()->undefined_value() || |
10166 Code::cast(*code)->kind() == Code::OPTIMIZED_FUNCTION); | 10166 Code::cast(*code)->kind() == Code::OPTIMIZED_FUNCTION); |
10167 DCHECK(native_context->IsNativeContext()); | 10167 DCHECK(native_context->IsNativeContext()); |
10168 STATIC_ASSERT(kEntryLength == 4); | 10168 STATIC_ASSERT(kEntryLength == 4); |
10169 Handle<FixedArray> new_code_map; | 10169 Handle<FixedArray> new_code_map; |
10170 Handle<Object> value(shared->optimized_code_map(), isolate); | 10170 Handle<Object> value(shared->optimized_code_map(), isolate); |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11340 int entry = SearchOptimizedCodeMapEntry(native_context, osr_ast_id); | 11340 int entry = SearchOptimizedCodeMapEntry(native_context, osr_ast_id); |
11341 if (entry != kNotFound) { | 11341 if (entry != kNotFound) { |
11342 FixedArray* code_map = FixedArray::cast(optimized_code_map()); | 11342 FixedArray* code_map = FixedArray::cast(optimized_code_map()); |
11343 if (entry == kSharedCodeIndex) { | 11343 if (entry == kSharedCodeIndex) { |
11344 result = {Code::cast(code_map->get(kSharedCodeIndex)), nullptr}; | 11344 result = {Code::cast(code_map->get(kSharedCodeIndex)), nullptr}; |
11345 | 11345 |
11346 } else { | 11346 } else { |
11347 DCHECK_LE(entry + kEntryLength, code_map->length()); | 11347 DCHECK_LE(entry + kEntryLength, code_map->length()); |
11348 Object* code = code_map->get(entry + kCachedCodeOffset); | 11348 Object* code = code_map->get(entry + kCachedCodeOffset); |
11349 result = {code->IsUndefined() ? nullptr : Code::cast(code), | 11349 result = {code->IsUndefined() ? nullptr : Code::cast(code), |
11350 FixedArray::cast(code_map->get(entry + kLiteralsOffset))}; | 11350 LiteralsArray::cast(code_map->get(entry + kLiteralsOffset))}; |
11351 } | 11351 } |
11352 } | 11352 } |
11353 if (FLAG_trace_opt && !optimized_code_map()->IsSmi() && | 11353 if (FLAG_trace_opt && !optimized_code_map()->IsSmi() && |
11354 result.code == nullptr) { | 11354 result.code == nullptr) { |
11355 PrintF("[didn't find optimized code in optimized code map for "); | 11355 PrintF("[didn't find optimized code in optimized code map for "); |
11356 ShortPrint(); | 11356 ShortPrint(); |
11357 PrintF("]\n"); | 11357 PrintF("]\n"); |
11358 } | 11358 } |
11359 return result; | 11359 return result; |
11360 } | 11360 } |
(...skipping 5394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16755 if (cell->value() != *new_value) { | 16755 if (cell->value() != *new_value) { |
16756 cell->set_value(*new_value); | 16756 cell->set_value(*new_value); |
16757 Isolate* isolate = cell->GetIsolate(); | 16757 Isolate* isolate = cell->GetIsolate(); |
16758 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16758 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
16759 isolate, DependentCode::kPropertyCellChangedGroup); | 16759 isolate, DependentCode::kPropertyCellChangedGroup); |
16760 } | 16760 } |
16761 } | 16761 } |
16762 | 16762 |
16763 } // namespace internal | 16763 } // namespace internal |
16764 } // namespace v8 | 16764 } // namespace v8 |
OLD | NEW |