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

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

Issue 1632993003: Revert of Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 } 3384 }
3385 3385
3386 3386
3387 LiteralsArray* LiteralsArray::cast(Object* object) { 3387 LiteralsArray* LiteralsArray::cast(Object* object) {
3388 SLOW_DCHECK(object->IsLiteralsArray()); 3388 SLOW_DCHECK(object->IsLiteralsArray());
3389 return reinterpret_cast<LiteralsArray*>(object); 3389 return reinterpret_cast<LiteralsArray*>(object);
3390 } 3390 }
3391 3391
3392 3392
3393 TypeFeedbackVector* LiteralsArray::feedback_vector() const { 3393 TypeFeedbackVector* LiteralsArray::feedback_vector() const {
3394 if (length() == 0) {
3395 return TypeFeedbackVector::cast(
3396 const_cast<FixedArray*>(FixedArray::cast(this)));
3397 }
3398 return TypeFeedbackVector::cast(get(kVectorIndex)); 3394 return TypeFeedbackVector::cast(get(kVectorIndex));
3399 } 3395 }
3400 3396
3401 3397
3402 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) { 3398 void LiteralsArray::set_feedback_vector(TypeFeedbackVector* vector) {
3403 if (length() <= kVectorIndex) {
3404 DCHECK(vector->length() == 0);
3405 return;
3406 }
3407 set(kVectorIndex, vector); 3399 set(kVectorIndex, vector);
3408 } 3400 }
3409 3401
3410 3402
3411 Object* LiteralsArray::literal(int literal_index) const { 3403 Object* LiteralsArray::literal(int literal_index) const {
3412 return get(kFirstLiteralIndex + literal_index); 3404 return get(kFirstLiteralIndex + literal_index);
3413 } 3405 }
3414 3406
3415 3407
3416 void LiteralsArray::set_literal(int literal_index, Object* literal) { 3408 void LiteralsArray::set_literal(int literal_index, Object* literal) {
3417 set(kFirstLiteralIndex + literal_index, literal); 3409 set(kFirstLiteralIndex + literal_index, literal);
3418 } 3410 }
3419 3411
3420 void LiteralsArray::set_literal_undefined(int literal_index) {
3421 set_undefined(kFirstLiteralIndex + literal_index);
3422 }
3423 3412
3424 int LiteralsArray::literals_count() const { 3413 int LiteralsArray::literals_count() const {
3425 return length() - kFirstLiteralIndex; 3414 return length() - kFirstLiteralIndex;
3426 } 3415 }
3427 3416
3428 3417
3429 void HandlerTable::SetRangeStart(int index, int value) { 3418 void HandlerTable::SetRangeStart(int index, int value) {
3430 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); 3419 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value));
3431 } 3420 }
3432 3421
(...skipping 2186 matching lines...) Expand 10 before | Expand all | Expand 10 after
5619 5608
5620 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex) 5609 SMI_ACCESSORS(BreakPointInfo, code_position, kCodePositionIndex)
5621 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex) 5610 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionIndex)
5622 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex) 5611 SMI_ACCESSORS(BreakPointInfo, statement_position, kStatementPositionIndex)
5623 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) 5612 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
5624 5613
5625 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) 5614 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
5626 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray, 5615 ACCESSORS(SharedFunctionInfo, optimized_code_map, FixedArray,
5627 kOptimizedCodeMapOffset) 5616 kOptimizedCodeMapOffset)
5628 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) 5617 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
5629 ACCESSORS(SharedFunctionInfo, feedback_metadata, TypeFeedbackMetadata, 5618 ACCESSORS(SharedFunctionInfo, feedback_vector, TypeFeedbackVector,
5630 kFeedbackMetadataOffset) 5619 kFeedbackVectorOffset)
5631 #if TRACE_MAPS 5620 #if TRACE_MAPS
5632 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset) 5621 SMI_ACCESSORS(SharedFunctionInfo, unique_id, kUniqueIdOffset)
5633 #endif 5622 #endif
5634 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, 5623 ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
5635 kInstanceClassNameOffset) 5624 kInstanceClassNameOffset)
5636 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) 5625 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset)
5637 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) 5626 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
5638 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) 5627 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
5639 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) 5628 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
5640 5629
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
5802 } 5791 }
5803 5792
5804 5793
5805 void SharedFunctionInfo::set_kind(FunctionKind kind) { 5794 void SharedFunctionInfo::set_kind(FunctionKind kind) {
5806 DCHECK(IsValidFunctionKind(kind)); 5795 DCHECK(IsValidFunctionKind(kind));
5807 int hints = compiler_hints(); 5796 int hints = compiler_hints();
5808 hints = FunctionKindBits::update(hints, kind); 5797 hints = FunctionKindBits::update(hints, kind);
5809 set_compiler_hints(hints); 5798 set_compiler_hints(hints);
5810 } 5799 }
5811 5800
5812 // static
5813 int SharedFunctionInfo::OffsetToPreviousContext() {
5814 return FixedArray::kHeaderSize +
5815 kPointerSize * (kContextOffset - kEntryLength);
5816 }
5817
5818 int SharedFunctionInfo::OffsetToPreviousCachedCode() {
5819 return FixedArray::kHeaderSize +
5820 kPointerSize * (kCachedCodeOffset - kEntryLength);
5821 }
5822
5823 int SharedFunctionInfo::OffsetToPreviousLiterals() {
5824 return FixedArray::kHeaderSize +
5825 kPointerSize * (kLiteralsOffset - kEntryLength);
5826 }
5827
5828 int SharedFunctionInfo::OffsetToPreviousOsrAstId() {
5829 return FixedArray::kHeaderSize +
5830 kPointerSize * (kOsrAstIdOffset - kEntryLength);
5831 }
5832 5801
5833 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object, 5802 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, needs_home_object,
5834 kNeedsHomeObject) 5803 kNeedsHomeObject)
5835 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) 5804 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative)
5836 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline) 5805 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, force_inline, kForceInline)
5837 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, 5806 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints,
5838 name_should_print_as_anonymous, 5807 name_should_print_as_anonymous,
5839 kNameShouldPrintAsAnonymous) 5808 kNameShouldPrintAsAnonymous)
5840 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) 5809 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous)
5841 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) 5810 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction)
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
6273 } 6242 }
6274 6243
6275 6244
6276 bool JSFunction::is_compiled() { 6245 bool JSFunction::is_compiled() {
6277 Builtins* builtins = GetIsolate()->builtins(); 6246 Builtins* builtins = GetIsolate()->builtins();
6278 return code() != builtins->builtin(Builtins::kCompileLazy) && 6247 return code() != builtins->builtin(Builtins::kCompileLazy) &&
6279 code() != builtins->builtin(Builtins::kCompileOptimized) && 6248 code() != builtins->builtin(Builtins::kCompileOptimized) &&
6280 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent); 6249 code() != builtins->builtin(Builtins::kCompileOptimizedConcurrent);
6281 } 6250 }
6282 6251
6283 TypeFeedbackVector* JSFunction::feedback_vector() {
6284 LiteralsArray* array = literals();
6285 return array->feedback_vector();
6286 }
6287 6252
6288 int JSFunction::NumberOfLiterals() { 6253 int JSFunction::NumberOfLiterals() {
6289 return literals()->length(); 6254 return literals()->length();
6290 } 6255 }
6291 6256
6292 6257
6293 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset) 6258 ACCESSORS(JSProxy, target, JSReceiver, kTargetOffset)
6294 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) 6259 ACCESSORS(JSProxy, handler, Object, kHandlerOffset)
6295 ACCESSORS(JSProxy, hash, Object, kHashOffset) 6260 ACCESSORS(JSProxy, hash, Object, kHashOffset)
6296 6261
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
7847 #undef WRITE_INT64_FIELD 7812 #undef WRITE_INT64_FIELD
7848 #undef READ_BYTE_FIELD 7813 #undef READ_BYTE_FIELD
7849 #undef WRITE_BYTE_FIELD 7814 #undef WRITE_BYTE_FIELD
7850 #undef NOBARRIER_READ_BYTE_FIELD 7815 #undef NOBARRIER_READ_BYTE_FIELD
7851 #undef NOBARRIER_WRITE_BYTE_FIELD 7816 #undef NOBARRIER_WRITE_BYTE_FIELD
7852 7817
7853 } // namespace internal 7818 } // namespace internal
7854 } // namespace v8 7819 } // namespace v8
7855 7820
7856 #endif // V8_OBJECTS_INL_H_ 7821 #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