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

Side by Side Diff: src/objects.cc

Issue 1374723002: Introduce LiteralsArray to hide it's implementation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix build break. Created 5 years, 2 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
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('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 // 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 8764 matching lines...) Expand 10 before | Expand all | Expand 10 after
8775 if (number_of_deopt_points == 0) { 8775 if (number_of_deopt_points == 0) {
8776 result = isolate->factory()->empty_fixed_array(); 8776 result = isolate->factory()->empty_fixed_array();
8777 } else { 8777 } else {
8778 result = isolate->factory()->NewFixedArray( 8778 result = isolate->factory()->NewFixedArray(
8779 LengthOfFixedArray(number_of_deopt_points), pretenure); 8779 LengthOfFixedArray(number_of_deopt_points), pretenure);
8780 } 8780 }
8781 return Handle<DeoptimizationOutputData>::cast(result); 8781 return Handle<DeoptimizationOutputData>::cast(result);
8782 } 8782 }
8783 8783
8784 8784
8785 // static
8786 Handle<LiteralsArray> LiteralsArray::New(Isolate* isolate,
8787 Handle<TypeFeedbackVector> vector,
8788 int number_of_literals,
8789 PretenureFlag pretenure) {
8790 Handle<FixedArray> literals = isolate->factory()->NewFixedArray(
8791 number_of_literals + kFirstLiteralIndex, pretenure);
8792 Handle<LiteralsArray> casted_literals = Handle<LiteralsArray>::cast(literals);
8793 casted_literals->set_feedback_vector(*vector);
8794 return casted_literals;
8795 }
8796
8797
8785 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out, 8798 int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out,
8786 CatchPrediction* prediction_out) { 8799 CatchPrediction* prediction_out) {
8787 int innermost_handler = -1, innermost_start = -1; 8800 int innermost_handler = -1, innermost_start = -1;
8788 for (int i = 0; i < length(); i += kRangeEntrySize) { 8801 for (int i = 0; i < length(); i += kRangeEntrySize) {
8789 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value(); 8802 int start_offset = Smi::cast(get(i + kRangeStartIndex))->value();
8790 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value(); 8803 int end_offset = Smi::cast(get(i + kRangeEndIndex))->value();
8791 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value(); 8804 int handler_field = Smi::cast(get(i + kRangeHandlerIndex))->value();
8792 int handler_offset = HandlerOffsetField::decode(handler_field); 8805 int handler_offset = HandlerOffsetField::decode(handler_field);
8793 CatchPrediction prediction = HandlerPredictionField::decode(handler_field); 8806 CatchPrediction prediction = HandlerPredictionField::decode(handler_field);
8794 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value(); 8807 int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value();
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after
10184 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); 10197 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION);
10185 Handle<Object> value(shared->optimized_code_map(), isolate); 10198 Handle<Object> value(shared->optimized_code_map(), isolate);
10186 if (value->IsSmi()) return; // Empty code maps are unsupported. 10199 if (value->IsSmi()) return; // Empty code maps are unsupported.
10187 Handle<FixedArray> code_map = Handle<FixedArray>::cast(value); 10200 Handle<FixedArray> code_map = Handle<FixedArray>::cast(value);
10188 code_map->set(kSharedCodeIndex, *code); 10201 code_map->set(kSharedCodeIndex, *code);
10189 } 10202 }
10190 10203
10191 10204
10192 void SharedFunctionInfo::AddToOptimizedCodeMap( 10205 void SharedFunctionInfo::AddToOptimizedCodeMap(
10193 Handle<SharedFunctionInfo> shared, Handle<Context> native_context, 10206 Handle<SharedFunctionInfo> shared, Handle<Context> native_context,
10194 Handle<HeapObject> code, Handle<FixedArray> literals, 10207 Handle<HeapObject> code, Handle<LiteralsArray> literals,
10195 BailoutId osr_ast_id) { 10208 BailoutId osr_ast_id) {
10196 Isolate* isolate = shared->GetIsolate(); 10209 Isolate* isolate = shared->GetIsolate();
10197 DCHECK(*code == isolate->heap()->undefined_value() || 10210 DCHECK(*code == isolate->heap()->undefined_value() ||
10198 !shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code); 10211 !shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code);
10199 DCHECK(*code == isolate->heap()->undefined_value() || 10212 DCHECK(*code == isolate->heap()->undefined_value() ||
10200 Code::cast(*code)->kind() == Code::OPTIMIZED_FUNCTION); 10213 Code::cast(*code)->kind() == Code::OPTIMIZED_FUNCTION);
10201 DCHECK(native_context->IsNativeContext()); 10214 DCHECK(native_context->IsNativeContext());
10202 STATIC_ASSERT(kEntryLength == 4); 10215 STATIC_ASSERT(kEntryLength == 4);
10203 Handle<FixedArray> new_code_map; 10216 Handle<FixedArray> new_code_map;
10204 Handle<Object> value(shared->optimized_code_map(), isolate); 10217 Handle<Object> value(shared->optimized_code_map(), isolate);
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
11374 int entry = SearchOptimizedCodeMapEntry(native_context, osr_ast_id); 11387 int entry = SearchOptimizedCodeMapEntry(native_context, osr_ast_id);
11375 if (entry != kNotFound) { 11388 if (entry != kNotFound) {
11376 FixedArray* code_map = FixedArray::cast(optimized_code_map()); 11389 FixedArray* code_map = FixedArray::cast(optimized_code_map());
11377 if (entry == kSharedCodeIndex) { 11390 if (entry == kSharedCodeIndex) {
11378 result = {Code::cast(code_map->get(kSharedCodeIndex)), nullptr}; 11391 result = {Code::cast(code_map->get(kSharedCodeIndex)), nullptr};
11379 11392
11380 } else { 11393 } else {
11381 DCHECK_LE(entry + kEntryLength, code_map->length()); 11394 DCHECK_LE(entry + kEntryLength, code_map->length());
11382 Object* code = code_map->get(entry + kCachedCodeOffset); 11395 Object* code = code_map->get(entry + kCachedCodeOffset);
11383 result = {code->IsUndefined() ? nullptr : Code::cast(code), 11396 result = {code->IsUndefined() ? nullptr : Code::cast(code),
11384 FixedArray::cast(code_map->get(entry + kLiteralsOffset))}; 11397 LiteralsArray::cast(code_map->get(entry + kLiteralsOffset))};
11385 } 11398 }
11386 } 11399 }
11387 if (FLAG_trace_opt && !optimized_code_map()->IsSmi() && 11400 if (FLAG_trace_opt && !optimized_code_map()->IsSmi() &&
11388 result.code == nullptr) { 11401 result.code == nullptr) {
11389 PrintF("[didn't find optimized code in optimized code map for "); 11402 PrintF("[didn't find optimized code in optimized code map for ");
11390 ShortPrint(); 11403 ShortPrint();
11391 PrintF("]\n"); 11404 PrintF("]\n");
11392 } 11405 }
11393 return result; 11406 return result;
11394 } 11407 }
(...skipping 5393 matching lines...) Expand 10 before | Expand all | Expand 10 after
16788 if (cell->value() != *new_value) { 16801 if (cell->value() != *new_value) {
16789 cell->set_value(*new_value); 16802 cell->set_value(*new_value);
16790 Isolate* isolate = cell->GetIsolate(); 16803 Isolate* isolate = cell->GetIsolate();
16791 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16804 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16792 isolate, DependentCode::kPropertyCellChangedGroup); 16805 isolate, DependentCode::kPropertyCellChangedGroup);
16793 } 16806 }
16794 } 16807 }
16795 16808
16796 } // namespace internal 16809 } // namespace internal
16797 } // namespace v8 16810 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698