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

Side by Side Diff: src/objects-inl.h

Issue 1642613002: Reland of Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: %SetCode failed to install literals in cache. Created 4 years, 10 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-debug.cc ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after
3383 } 3383 }
3384 3384
3385 3385
3386 LiteralsArray* LiteralsArray::cast(Object* object) { 3386 LiteralsArray* LiteralsArray::cast(Object* object) {
3387 SLOW_DCHECK(object->IsLiteralsArray()); 3387 SLOW_DCHECK(object->IsLiteralsArray());
3388 return reinterpret_cast<LiteralsArray*>(object); 3388 return reinterpret_cast<LiteralsArray*>(object);
3389 } 3389 }
3390 3390
3391 3391
3392 TypeFeedbackVector* LiteralsArray::feedback_vector() const { 3392 TypeFeedbackVector* LiteralsArray::feedback_vector() const {
3393 if (length() == 0) {
3394 return TypeFeedbackVector::cast(
3395 const_cast<FixedArray*>(FixedArray::cast(this)));
3396 }
3393 return TypeFeedbackVector::cast(get(kVectorIndex)); 3397 return TypeFeedbackVector::cast(get(kVectorIndex));
3394 } 3398 }
3395 3399
3396 3400
3397 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { 3401 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) {
3402 if (length() <= kVectorIndex) {
3403 DCHECK(vector->length() == 0);
3404 return;
3405 }
3398 set(kVectorIndex, vector); 3406 set(kVectorIndex, vector);
3399 } 3407 }
3400 3408
3401 3409
3402 Object* LiteralsArray::literal(int literal_index) const { 3410 Object* LiteralsArray::literal(int literal_index) const {
3403 return get(kFirstLiteralIndex + literal_index); 3411 return get(kFirstLiteralIndex + literal_index);
3404 } 3412 }
3405 3413
3406 3414
3407 void LiteralsArray::set_literal(int literal_index, Object* literal) { 3415 void LiteralsArray::set_literal(int literal_index, Object* literal) {
3408 set(kFirstLiteralIndex + literal_index, literal); 3416 set(kFirstLiteralIndex + literal_index, literal);
3409 } 3417 }
3410 3418
3419 void LiteralsArray::set_literal_undefined(int literal_index) {
3420 set_undefined(kFirstLiteralIndex + literal_index);
3421 }
3411 3422
3412 int LiteralsArray::literals_count() const { 3423 int LiteralsArray::literals_count() const {
3413 return length() - kFirstLiteralIndex; 3424 return length() - kFirstLiteralIndex;
3414 } 3425 }
3415 3426
3416 3427
3417 void HandlerTable::SetRangeStart(int index, int value) { 3428 void HandlerTable::SetRangeStart(int index, int value) {
3418 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); 3429 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value));
3419 } 3430 }
3420 3431
(...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after
5614 5625
5615 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex) 5626 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex)
5616 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) 5627 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex)
5617 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) 5628 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex)
5618 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) 5629 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
5619 5630
5620 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) 5631 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
5621 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, 5632 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray,
5622 kOptimizedCodeMapOffset) 5633 kOptimizedCodeMapOffset)
5623 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) 5634 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
5624 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, 5635 ACCESSORS(SharedFunctionInfo, feedback_metadata, TypeFeedbackMetadata,
5625 kFeedbackVectorOffset) 5636 kFeedbackMetadataOffset)
5626 #if TRACE_MAPS 5637 #if TRACE_MAPS
5627 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) 5638 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset)
5628 #endif 5639 #endif
5629 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, 5640 ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
5630 kInstanceClassNameOffset) 5641 kInstanceClassNameOffset)
5631 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) 5642 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset)
5632 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) 5643 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
5633 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) 5644 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
5634 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) 5645 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
5635 5646
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
5797 } 5808 }
5798 5809
5799 5810
5800 void SharedFunctionInfo::set_kind(FunctionKind kind) { 5811 void SharedFunctionInfo::set_kind(FunctionKind kind) {
5801 DCHECK(IsValidFunctionKind(kind)); 5812 DCHECK(IsValidFunctionKind(kind));
5802 int hints = compiler_hints(); 5813 int hints = compiler_hints();
5803 hints = FunctionKindBits::update(hints, kind); 5814 hints = FunctionKindBits::update(hints, kind);
5804 set_compiler_hints(hints); 5815 set_compiler_hints(hints);
5805 } 5816 }
5806 5817
5818 // static
5819 int SharedFunctionInfo::OffsetToPreviousContext() {
5820 return FixedArray::kHeaderSize +
5821 kPointerSize * (kContextOffset - kEntryLength);
5822 }
5823
5824 int SharedFunctionInfo::OffsetToPreviousCachedCode() {
5825 return FixedArray::kHeaderSize +
5826 kPointerSize * (kCachedCodeOffset - kEntryLength);
5827 }
5828
5829 int SharedFunctionInfo::OffsetToPreviousLiterals() {
5830 return FixedArray::kHeaderSize +
5831 kPointerSize * (kLiteralsOffset - kEntryLength);
5832 }
5833
5834 int SharedFunctionInfo::OffsetToPreviousOsrAstId() {
5835 return FixedArray::kHeaderSize +
5836 kPointerSize * (kOsrAstIdOffset - kEntryLength);
5837 }
5807 5838
5808 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object, 5839 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object,
5809 kNeedsHomeObject) 5840 kNeedsHomeObject)
5810 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) 5841 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative)
5811 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline) 5842 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline)
5812 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, 5843 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints,
5813 name_should_print_as_anonymous, 5844 name_should_print_as_anonymous,
5814 kNameShouldPrintAsAnonymous) 5845 kNameShouldPrintAsAnonymous)
5815 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) 5846 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous)
5816 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) 5847 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction)
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
6248 } 6279 }
6249 6280
6250 6281
6251 bool JSFunction::is_compiled() { 6282 bool JSFunction::is_compiled() {
6252 Builtins* builtins = GetIsolate()->builtins(); 6283 Builtins* builtins = GetIsolate()->builtins();
6253 return code() != builtins->builtin(Builtins::kCompileLazy) && 6284 return code() != builtins->builtin(Builtins::kCompileLazy) &&
6254 code() != builtins->builtin(Builtins::kCompileOptimized) && 6285 code() != builtins->builtin(Builtins::kCompileOptimized) &&
6255 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); 6286 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent);
6256 } 6287 }
6257 6288
6258 6289 TypeFeedbackVector* JSFunction::feedback_vector() {
6259 int JSFunction::NumberOfLiterals() { 6290 LiteralsArray* array = literals();
6260 return literals()->length(); 6291 return array->feedback_vector();
6261 } 6292 }
6262 6293
6294 int JSFunction::NumberOfLiterals() { return literals()->literals_count(); }
6263 6295
6264 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) 6296 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset)
6265 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) 6297 ACCESSORS(JSProxy, handler, Object, kHandlerOffset)
6266 ACCESSORS(JSProxy, hash, Object, kHashOffset) 6298 ACCESSORS(JSProxy, hash, Object, kHashOffset)
6267 6299
6268 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } 6300 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); }
6269 6301
6270 ACCESSORS(JSCollection, table, Object, kTableOffset) 6302 ACCESSORS(JSCollection, table, Object, kTableOffset)
6271 6303
6272 6304
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
7818 #undef WRITE_INT64_FIELD 7850 #undef WRITE_INT64_FIELD
7819 #undef READ_BYTE_FIELD 7851 #undef READ_BYTE_FIELD
7820 #undef WRITE_BYTE_FIELD 7852 #undef WRITE_BYTE_FIELD
7821 #undef NOBARRIER_READ_BYTE_FIELD 7853 #undef NOBARRIER_READ_BYTE_FIELD
7822 #undef NOBARRIER_WRITE_BYTE_FIELD 7854 #undef NOBARRIER_WRITE_BYTE_FIELD
7823 7855
7824 } // namespace internal 7856 } // namespace internal
7825 } // namespace v8 7857 } // namespace v8
7826 7858
7827 #endif // V8_OBJECTS_INL_H_ 7859 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698