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

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

Issue 1563213002: Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. Created 4 years, 11 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
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 3389 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 } 3400 }
3401 3401
3402 3402
3403 LiteralsArray* LiteralsArray::cast(Object* object) { 3403 LiteralsArray* LiteralsArray::cast(Object* object) {
3404 SLOW_DCHECK(object->IsLiteralsArray()); 3404 SLOW_DCHECK(object->IsLiteralsArray());
3405 return reinterpret_cast<LiteralsArray*>(object); 3405 return reinterpret_cast<LiteralsArray*>(object);
3406 } 3406 }
3407 3407
3408 3408
3409 TypeFeedbackVector* LiteralsArray::feedback_vector() const { 3409 TypeFeedbackVector* LiteralsArray::feedback_vector() const {
3410 if (length() == 0) {
3411 return TypeFeedbackVector::cast(
3412 const_cast<FixedArray*>(FixedArray::cast(this)));
3413 }
3410 return TypeFeedbackVector::cast(get(kVectorIndex)); 3414 return TypeFeedbackVector::cast(get(kVectorIndex));
3411 } 3415 }
3412 3416
3413 3417
3414 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { 3418 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) {
3419 if (length() <= kVectorIndex) {
3420 DCHECK(vector->length() == 0);
3421 return;
3422 }
3415 set(kVectorIndex, vector); 3423 set(kVectorIndex, vector);
3416 } 3424 }
3417 3425
3418 3426
3419 Object* LiteralsArray::literal(int literal_index) const { 3427 Object* LiteralsArray::literal(int literal_index) const {
3420 return get(kFirstLiteralIndex + literal_index); 3428 return get(kFirstLiteralIndex + literal_index);
3421 } 3429 }
3422 3430
3423 3431
3424 void LiteralsArray::set_literal(int literal_index, Object* literal) { 3432 void LiteralsArray::set_literal(int literal_index, Object* literal) {
3425 set(kFirstLiteralIndex + literal_index, literal); 3433 set(kFirstLiteralIndex + literal_index, literal);
3426 } 3434 }
3427 3435
3428 3436
3437 void LiteralsArray::set_literal_undefined(int literal_index) {
3438 set_undefined(kFirstLiteralIndex + literal_index);
3439 }
3440
3441
3429 int LiteralsArray::literals_count() const { 3442 int LiteralsArray::literals_count() const {
3430 return length() - kFirstLiteralIndex; 3443 return length() - kFirstLiteralIndex;
3431 } 3444 }
3432 3445
3433 3446
3434 void HandlerTable::SetRangeStart(int index, int value) { 3447 void HandlerTable::SetRangeStart(int index, int value) {
3435 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); 3448 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value));
3436 } 3449 }
3437 3450
3438 3451
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
5618 5631
5619 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex) 5632 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex)
5620 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) 5633 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex)
5621 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) 5634 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex)
5622 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) 5635 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
5623 5636
5624 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) 5637 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
5625 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, 5638 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray,
5626 kOptimizedCodeMapOffset) 5639 kOptimizedCodeMapOffset)
5627 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) 5640 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
5628 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector, 5641 ACCESSORS(SharedFunctionInfo, feedback_metadata, TypeFeedbackMetadata,
5629 kFeedbackVectorOffset) 5642 kFeedbackMetadataOffset)
5630 #if TRACE_MAPS 5643 #if TRACE_MAPS
5631 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) 5644 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset)
5632 #endif 5645 #endif
5633 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, 5646 ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
5634 kInstanceClassNameOffset) 5647 kInstanceClassNameOffset)
5635 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) 5648 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset)
5636 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) 5649 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
5637 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) 5650 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
5638 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) 5651 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
5639 5652
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
5802 5815
5803 5816
5804 void SharedFunctionInfo::set_kind(FunctionKind kind) { 5817 void SharedFunctionInfo::set_kind(FunctionKind kind) {
5805 DCHECK(IsValidFunctionKind(kind)); 5818 DCHECK(IsValidFunctionKind(kind));
5806 int hints = compiler_hints(); 5819 int hints = compiler_hints();
5807 hints = FunctionKindBits::update(hints, kind); 5820 hints = FunctionKindBits::update(hints, kind);
5808 set_compiler_hints(hints); 5821 set_compiler_hints(hints);
5809 } 5822 }
5810 5823
5811 5824
5825 // static
5826 int SharedFunctionInfo::OffsetToPreviousContext() {
5827 return FixedArray::kHeaderSize +
5828 kPointerSize * (kContextOffset - kEntryLength);
5829 }
5830
5831
5832 int SharedFunctionInfo::OffsetToPreviousCachedCode() {
5833 return FixedArray::kHeaderSize +
5834 kPointerSize * (kCachedCodeOffset - kEntryLength);
5835 }
5836
5837
5838 int SharedFunctionInfo::OffsetToPreviousLiterals() {
5839 return FixedArray::kHeaderSize +
5840 kPointerSize * (kLiteralsOffset - kEntryLength);
5841 }
5842
5843
5844 int SharedFunctionInfo::OffsetToPreviousOsrAstId() {
5845 return FixedArray::kHeaderSize +
5846 kPointerSize * (kOsrAstIdOffset - kEntryLength);
5847 }
5848
5849
5812 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object, 5850 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object,
5813 kNeedsHomeObject) 5851 kNeedsHomeObject)
5814 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) 5852 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative)
5815 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline) 5853 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline)
5816 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, 5854 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints,
5817 name_should_print_as_anonymous, 5855 name_should_print_as_anonymous,
5818 kNameShouldPrintAsAnonymous) 5856 kNameShouldPrintAsAnonymous)
5819 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) 5857 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous)
5820 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) 5858 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction)
5821 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_crankshaft, 5859 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_crankshaft,
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
6253 6291
6254 6292
6255 bool JSFunction::is_compiled() { 6293 bool JSFunction::is_compiled() {
6256 Builtins* builtins = GetIsolate()->builtins(); 6294 Builtins* builtins = GetIsolate()->builtins();
6257 return code() != builtins->builtin(Builtins::kCompileLazy) && 6295 return code() != builtins->builtin(Builtins::kCompileLazy) &&
6258 code() != builtins->builtin(Builtins::kCompileOptimized) && 6296 code() != builtins->builtin(Builtins::kCompileOptimized) &&
6259 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); 6297 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent);
6260 } 6298 }
6261 6299
6262 6300
6301 TypeFeedbackVector* JSFunction::feedback_vector() {
6302 LiteralsArray* array = literals();
6303 return array->feedback_vector();
6304 }
6305
6306
6263 int JSFunction::NumberOfLiterals() { 6307 int JSFunction::NumberOfLiterals() {
6264 return literals()->length(); 6308 return literals()->length();
6265 } 6309 }
6266 6310
6267 6311
6268 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) 6312 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset)
6269 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) 6313 ACCESSORS(JSProxy, handler, Object, kHandlerOffset)
6270 ACCESSORS(JSProxy, hash, Object, kHashOffset) 6314 ACCESSORS(JSProxy, hash, Object, kHashOffset)
6271 6315
6272 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); } 6316 bool JSProxy::IsRevoked() const { return !handler()->IsJSReceiver(); }
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
7796 #undef WRITE_INT64_FIELD 7840 #undef WRITE_INT64_FIELD
7797 #undef READ_BYTE_FIELD 7841 #undef READ_BYTE_FIELD
7798 #undef WRITE_BYTE_FIELD 7842 #undef WRITE_BYTE_FIELD
7799 #undef NOBARRIER_READ_BYTE_FIELD 7843 #undef NOBARRIER_READ_BYTE_FIELD
7800 #undef NOBARRIER_WRITE_BYTE_FIELD 7844 #undef NOBARRIER_WRITE_BYTE_FIELD
7801 7845
7802 } // namespace internal 7846 } // namespace internal
7803 } // namespace v8 7847 } // namespace v8
7804 7848
7805 #endif // V8_OBJECTS_INL_H_ 7849 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/crankshaft/hydrogen.cc ('K') | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698