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

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

Issue 12225099: Remove prototype checks for leaf maps in optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rename "dependent codes" and add comment. Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 bool Object::IsDeoptimizationOutputData() { 577 bool Object::IsDeoptimizationOutputData() {
578 if (!IsFixedArray()) return false; 578 if (!IsFixedArray()) return false;
579 // There's actually no way to see the difference between a fixed array and 579 // There's actually no way to see the difference between a fixed array and
580 // a deoptimization data array. Since this is used for asserts we can check 580 // a deoptimization data array. Since this is used for asserts we can check
581 // that the length is plausible though. 581 // that the length is plausible though.
582 if (FixedArray::cast(this)->length() % 2 != 0) return false; 582 if (FixedArray::cast(this)->length() % 2 != 0) return false;
583 return true; 583 return true;
584 } 584 }
585 585
586 586
587 bool Object::IsDependentCodes() { 587 bool Object::IsDependentCode() {
588 if (!IsFixedArray()) return false; 588 if (!IsFixedArray()) return false;
589 // There's actually no way to see the difference between a fixed array and 589 // There's actually no way to see the difference between a fixed array and
590 // a dependent codes array. 590 // a dependent codes array.
591 return true; 591 return true;
592 } 592 }
593 593
594 594
595 bool Object::IsTypeFeedbackCells() { 595 bool Object::IsTypeFeedbackCells() {
596 if (!IsFixedArray()) return false; 596 if (!IsFixedArray()) return false;
597 // There's actually no way to see the difference between a fixed array and 597 // There's actually no way to see the difference between a fixed array and
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after
2385 2385
2386 // ------------------------------------ 2386 // ------------------------------------
2387 // Cast operations 2387 // Cast operations
2388 2388
2389 2389
2390 CAST_ACCESSOR(FixedArray) 2390 CAST_ACCESSOR(FixedArray)
2391 CAST_ACCESSOR(FixedDoubleArray) 2391 CAST_ACCESSOR(FixedDoubleArray)
2392 CAST_ACCESSOR(DescriptorArray) 2392 CAST_ACCESSOR(DescriptorArray)
2393 CAST_ACCESSOR(DeoptimizationInputData) 2393 CAST_ACCESSOR(DeoptimizationInputData)
2394 CAST_ACCESSOR(DeoptimizationOutputData) 2394 CAST_ACCESSOR(DeoptimizationOutputData)
2395 CAST_ACCESSOR(DependentCodes) 2395 CAST_ACCESSOR(DependentCode)
2396 CAST_ACCESSOR(TypeFeedbackCells) 2396 CAST_ACCESSOR(TypeFeedbackCells)
2397 CAST_ACCESSOR(SymbolTable) 2397 CAST_ACCESSOR(SymbolTable)
2398 CAST_ACCESSOR(JSFunctionResultCache) 2398 CAST_ACCESSOR(JSFunctionResultCache)
2399 CAST_ACCESSOR(NormalizedMapCache) 2399 CAST_ACCESSOR(NormalizedMapCache)
2400 CAST_ACCESSOR(ScopeInfo) 2400 CAST_ACCESSOR(ScopeInfo)
2401 CAST_ACCESSOR(CompilationCacheTable) 2401 CAST_ACCESSOR(CompilationCacheTable)
2402 CAST_ACCESSOR(CodeCacheHashTable) 2402 CAST_ACCESSOR(CodeCacheHashTable)
2403 CAST_ACCESSOR(PolymorphicCodeCacheHashTable) 2403 CAST_ACCESSOR(PolymorphicCodeCacheHashTable)
2404 CAST_ACCESSOR(MapCache) 2404 CAST_ACCESSOR(MapCache)
2405 CAST_ACCESSOR(String) 2405 CAST_ACCESSOR(String)
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
3417 instance_type() > LAST_JS_OBJECT_TYPE || 3417 instance_type() > LAST_JS_OBJECT_TYPE ||
3418 has_slow_elements_kind() || has_external_array_elements()); 3418 has_slow_elements_kind() || has_external_array_elements());
3419 set_bit_field3(IsObserved::update(bit_field3(), is_observed)); 3419 set_bit_field3(IsObserved::update(bit_field3(), is_observed));
3420 } 3420 }
3421 3421
3422 3422
3423 bool Map::is_observed() { 3423 bool Map::is_observed() {
3424 return IsObserved::decode(bit_field3()); 3424 return IsObserved::decode(bit_field3());
3425 } 3425 }
3426 3426
3427 void Map::NotifyObjectLayoutChange() {
3428 DeoptimizeDependentCode(DependentCode::kPrototypeCheckGroup);
3429 }
3427 3430
3428 void Map::AddDependentCode(DependentCodes::DependencyGroup group, 3431 bool Map::CanOmitPrototypeChecks() {
3432 return !HasTransitionArray() && !is_dictionary_map();
3433 }
3434
3435 void Map::AddDependentCode(DependentCode::DependencyGroup group,
3429 Handle<Code> code) { 3436 Handle<Code> code) {
3430 Handle<DependentCodes> codes = 3437 Handle<DependentCode> codes =
3431 DependentCodes::Insert(Handle<DependentCodes>(dependent_codes()), 3438 DependentCode::Insert(Handle<DependentCode>(dependent_code()),
3432 group, code); 3439 group, code);
3433 if (*codes != dependent_codes()) { 3440 if (*codes != dependent_code()) {
3434 set_dependent_codes(*codes); 3441 set_dependent_code(*codes);
3435 } 3442 }
3436 } 3443 }
3437 3444
3438 3445
3439 int DependentCodes::number_of_codes(DependencyGroup group) { 3446 int DependentCode::number_of_codes(DependencyGroup group) {
3440 if (length() == 0) return 0; 3447 if (length() == 0) return 0;
3441 return Smi::cast(get(group))->value(); 3448 return Smi::cast(get(group))->value();
3442 } 3449 }
3443 3450
3444 3451
3445 void DependentCodes::set_number_of_codes(DependencyGroup group, int value) { 3452 void DependentCode::set_number_of_codes(DependencyGroup group, int value) {
3446 set(group, Smi::FromInt(value)); 3453 set(group, Smi::FromInt(value));
3447 } 3454 }
3448 3455
3449 3456
3450 Code* DependentCodes::code_at(int i) { 3457 Code* DependentCode::code_at(int i) {
3451 return Code::cast(get(kCodesStartIndex + i)); 3458 return Code::cast(get(kCodesStartIndex + i));
3452 } 3459 }
3453 3460
3454 3461
3455 void DependentCodes::set_code_at(int i, Code* value) { 3462 void DependentCode::set_code_at(int i, Code* value) {
3456 set(kCodesStartIndex + i, value); 3463 set(kCodesStartIndex + i, value);
3457 } 3464 }
3458 3465
3459 3466
3460 Object** DependentCodes::code_slot_at(int i) { 3467 Object** DependentCode::code_slot_at(int i) {
3461 return HeapObject::RawField( 3468 return HeapObject::RawField(
3462 this, FixedArray::OffsetOfElementAt(kCodesStartIndex + i)); 3469 this, FixedArray::OffsetOfElementAt(kCodesStartIndex + i));
3463 } 3470 }
3464 3471
3465 3472
3466 void DependentCodes::clear_code_at(int i) { 3473 void DependentCode::clear_code_at(int i) {
3467 set_undefined(kCodesStartIndex + i); 3474 set_undefined(kCodesStartIndex + i);
3468 } 3475 }
3469 3476
3470 3477
3471 void DependentCodes::ComputeGroupStartIndexes(GroupStartIndexes starts) { 3478 void DependentCode::ExtendGroup(DependencyGroup group) {
3472 starts[0] = 0; 3479 GroupStartIndexes starts(this);
3473 for (int g = 1; g <= kGroupCount; g++) { 3480 for (int g = kGroupCount - 1; g > group; g--) {
3474 int count = number_of_codes(static_cast<DependencyGroup>(g - 1)); 3481 if (starts.at(g) < starts.at(g + 1)) {
3475 starts[g] = starts[g - 1] + count; 3482 set_code_at(starts.at(g + 1), code_at(starts.at(g)));
3483 }
3476 } 3484 }
3477 } 3485 }
3478 3486
3479
3480 void DependentCodes::ExtendGroup(DependencyGroup group) {
3481 GroupStartIndexes starts;
3482 ComputeGroupStartIndexes(starts);
3483 for (int g = kGroupCount - 2; g > group; g--) {
3484 set_code_at(starts[g + 1], code_at(starts[g]));
3485 }
3486 }
3487
3488 3487
3489 void Code::set_flags(Code::Flags flags) { 3488 void Code::set_flags(Code::Flags flags) {
3490 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1); 3489 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= KindField::kMax + 1);
3491 // Make sure that all call stubs have an arguments count. 3490 // Make sure that all call stubs have an arguments count.
3492 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && 3491 ASSERT((ExtractKindFromFlags(flags) != CALL_IC &&
3493 ExtractKindFromFlags(flags) != KEYED_CALL_IC) || 3492 ExtractKindFromFlags(flags) != KEYED_CALL_IC) ||
3494 ExtractArgumentsCountFromFlags(flags) >= 0); 3493 ExtractArgumentsCountFromFlags(flags) >= 0);
3495 WRITE_INT_FIELD(this, kFlagsOffset, flags); 3494 WRITE_INT_FIELD(this, kFlagsOffset, flags);
3496 } 3495 }
3497 3496
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 4100
4102 4101
4103 HeapObject* Map::UncheckedPrototypeTransitions() { 4102 HeapObject* Map::UncheckedPrototypeTransitions() {
4104 ASSERT(HasTransitionArray()); 4103 ASSERT(HasTransitionArray());
4105 ASSERT(unchecked_transition_array()->HasPrototypeTransitions()); 4104 ASSERT(unchecked_transition_array()->HasPrototypeTransitions());
4106 return unchecked_transition_array()->UncheckedPrototypeTransitions(); 4105 return unchecked_transition_array()->UncheckedPrototypeTransitions();
4107 } 4106 }
4108 4107
4109 4108
4110 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) 4109 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
4111 ACCESSORS(Map, dependent_codes, DependentCodes, kDependentCodesOffset) 4110 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset)
4112 ACCESSORS(Map, constructor, Object, kConstructorOffset) 4111 ACCESSORS(Map, constructor, Object, kConstructorOffset)
4113 4112
4114 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) 4113 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
4115 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset) 4114 ACCESSORS(JSFunction, literals_or_bindings, FixedArray, kLiteralsOffset)
4116 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset) 4115 ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset)
4117 4116
4118 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) 4117 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
4119 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset) 4118 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset)
4120 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) 4119 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
4121 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) 4120 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset)
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after
5910 #undef WRITE_UINT32_FIELD 5909 #undef WRITE_UINT32_FIELD
5911 #undef READ_SHORT_FIELD 5910 #undef READ_SHORT_FIELD
5912 #undef WRITE_SHORT_FIELD 5911 #undef WRITE_SHORT_FIELD
5913 #undef READ_BYTE_FIELD 5912 #undef READ_BYTE_FIELD
5914 #undef WRITE_BYTE_FIELD 5913 #undef WRITE_BYTE_FIELD
5915 5914
5916 5915
5917 } } // namespace v8::internal 5916 } } // namespace v8::internal
5918 5917
5919 #endif // V8_OBJECTS_INL_H_ 5918 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.h ('K') | « src/objects-debug.cc ('k') | src/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698