| OLD | NEW |
| 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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 } | 910 } |
| 911 return Failure::Exception(); | 911 return Failure::Exception(); |
| 912 } | 912 } |
| 913 | 913 |
| 914 | 914 |
| 915 bool Object::HasSpecificClassOf(String* name) { | 915 bool Object::HasSpecificClassOf(String* name) { |
| 916 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); | 916 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); |
| 917 } | 917 } |
| 918 | 918 |
| 919 | 919 |
| 920 MaybeObject* Object::GetElement(uint32_t index) { | 920 MaybeObject* Object::GetElement(Isolate* isolate, uint32_t index) { |
| 921 // GetElement can trigger a getter which can cause allocation. | 921 // GetElement can trigger a getter which can cause allocation. |
| 922 // This was not always the case. This ASSERT is here to catch | 922 // This was not always the case. This ASSERT is here to catch |
| 923 // leftover incorrect uses. | 923 // leftover incorrect uses. |
| 924 ASSERT(AllowHeapAllocation::IsAllowed()); | 924 ASSERT(AllowHeapAllocation::IsAllowed()); |
| 925 return GetElementWithReceiver(this, index); | 925 return GetElementWithReceiver(isolate, this, index); |
| 926 } | 926 } |
| 927 | 927 |
| 928 | 928 |
| 929 Object* Object::GetElementNoExceptionThrown(uint32_t index) { | 929 Object* Object::GetElementNoExceptionThrown(Isolate* isolate, uint32_t index) { |
| 930 MaybeObject* maybe = GetElementWithReceiver(this, index); | 930 MaybeObject* maybe = GetElementWithReceiver(isolate, this, index); |
| 931 ASSERT(!maybe->IsFailure()); | 931 ASSERT(!maybe->IsFailure()); |
| 932 Object* result = NULL; // Initialization to please compiler. | 932 Object* result = NULL; // Initialization to please compiler. |
| 933 maybe->ToObject(&result); | 933 maybe->ToObject(&result); |
| 934 return result; | 934 return result; |
| 935 } | 935 } |
| 936 | 936 |
| 937 | 937 |
| 938 MaybeObject* Object::GetProperty(Name* key) { | 938 MaybeObject* Object::GetProperty(Name* key) { |
| 939 PropertyAttributes attributes; | 939 PropertyAttributes attributes; |
| 940 return GetPropertyWithReceiver(this, key, &attributes); | 940 return GetPropertyWithReceiver(this, key, &attributes); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1178 void HeapObject::VerifySmiField(int offset) { | 1178 void HeapObject::VerifySmiField(int offset) { |
| 1179 CHECK(READ_FIELD(this, offset)->IsSmi()); | 1179 CHECK(READ_FIELD(this, offset)->IsSmi()); |
| 1180 } | 1180 } |
| 1181 #endif | 1181 #endif |
| 1182 | 1182 |
| 1183 | 1183 |
| 1184 Heap* HeapObject::GetHeap() { | 1184 Heap* HeapObject::GetHeap() { |
| 1185 Heap* heap = | 1185 Heap* heap = |
| 1186 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); | 1186 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); |
| 1187 ASSERT(heap != NULL); | 1187 ASSERT(heap != NULL); |
| 1188 ASSERT(heap->isolate() == Isolate::Current()); | |
| 1189 return heap; | 1188 return heap; |
| 1190 } | 1189 } |
| 1191 | 1190 |
| 1192 | 1191 |
| 1193 Isolate* HeapObject::GetIsolate() { | 1192 Isolate* HeapObject::GetIsolate() { |
| 1194 return GetHeap()->isolate(); | 1193 return GetHeap()->isolate(); |
| 1195 } | 1194 } |
| 1196 | 1195 |
| 1197 | 1196 |
| 1198 Map* HeapObject::map() { | 1197 Map* HeapObject::map() { |
| (...skipping 2989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4188 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); | 4187 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kPrototypeOffset, value, mode); |
| 4189 } | 4188 } |
| 4190 | 4189 |
| 4191 | 4190 |
| 4192 // If the descriptor is using the empty transition array, install a new empty | 4191 // If the descriptor is using the empty transition array, install a new empty |
| 4193 // transition array that will have place for an element transition. | 4192 // transition array that will have place for an element transition. |
| 4194 static MaybeObject* EnsureHasTransitionArray(Map* map) { | 4193 static MaybeObject* EnsureHasTransitionArray(Map* map) { |
| 4195 TransitionArray* transitions; | 4194 TransitionArray* transitions; |
| 4196 MaybeObject* maybe_transitions; | 4195 MaybeObject* maybe_transitions; |
| 4197 if (!map->HasTransitionArray()) { | 4196 if (!map->HasTransitionArray()) { |
| 4198 maybe_transitions = TransitionArray::Allocate(0); | 4197 maybe_transitions = TransitionArray::Allocate(map->GetIsolate(), 0); |
| 4199 if (!maybe_transitions->To(&transitions)) return maybe_transitions; | 4198 if (!maybe_transitions->To(&transitions)) return maybe_transitions; |
| 4200 transitions->set_back_pointer_storage(map->GetBackPointer()); | 4199 transitions->set_back_pointer_storage(map->GetBackPointer()); |
| 4201 } else if (!map->transitions()->IsFullTransitionArray()) { | 4200 } else if (!map->transitions()->IsFullTransitionArray()) { |
| 4202 maybe_transitions = map->transitions()->ExtendToFullTransitionArray(); | 4201 maybe_transitions = map->transitions()->ExtendToFullTransitionArray(); |
| 4203 if (!maybe_transitions->To(&transitions)) return maybe_transitions; | 4202 if (!maybe_transitions->To(&transitions)) return maybe_transitions; |
| 4204 } else { | 4203 } else { |
| 4205 return map; | 4204 return map; |
| 4206 } | 4205 } |
| 4207 map->set_transitions(transitions); | 4206 map->set_transitions(transitions); |
| 4208 return transitions; | 4207 return transitions; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4459 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset) | 4458 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset) |
| 4460 ACCESSORS(InterceptorInfo, deleter, Object, kDeleterOffset) | 4459 ACCESSORS(InterceptorInfo, deleter, Object, kDeleterOffset) |
| 4461 ACCESSORS(InterceptorInfo, enumerator, Object, kEnumeratorOffset) | 4460 ACCESSORS(InterceptorInfo, enumerator, Object, kEnumeratorOffset) |
| 4462 ACCESSORS(InterceptorInfo, data, Object, kDataOffset) | 4461 ACCESSORS(InterceptorInfo, data, Object, kDataOffset) |
| 4463 | 4462 |
| 4464 ACCESSORS(CallHandlerInfo, callback, Object, kCallbackOffset) | 4463 ACCESSORS(CallHandlerInfo, callback, Object, kCallbackOffset) |
| 4465 ACCESSORS(CallHandlerInfo, data, Object, kDataOffset) | 4464 ACCESSORS(CallHandlerInfo, data, Object, kDataOffset) |
| 4466 | 4465 |
| 4467 ACCESSORS(TemplateInfo, tag, Object, kTagOffset) | 4466 ACCESSORS(TemplateInfo, tag, Object, kTagOffset) |
| 4468 ACCESSORS(TemplateInfo, property_list, Object, kPropertyListOffset) | 4467 ACCESSORS(TemplateInfo, property_list, Object, kPropertyListOffset) |
| 4468 ACCESSORS(TemplateInfo, property_accessors, Object, kPropertyAccessorsOffset) |
| 4469 | 4469 |
| 4470 ACCESSORS(FunctionTemplateInfo, serial_number, Object, kSerialNumberOffset) | 4470 ACCESSORS(FunctionTemplateInfo, serial_number, Object, kSerialNumberOffset) |
| 4471 ACCESSORS(FunctionTemplateInfo, call_code, Object, kCallCodeOffset) | 4471 ACCESSORS(FunctionTemplateInfo, call_code, Object, kCallCodeOffset) |
| 4472 ACCESSORS(FunctionTemplateInfo, property_accessors, Object, | |
| 4473 kPropertyAccessorsOffset) | |
| 4474 ACCESSORS(FunctionTemplateInfo, prototype_template, Object, | 4472 ACCESSORS(FunctionTemplateInfo, prototype_template, Object, |
| 4475 kPrototypeTemplateOffset) | 4473 kPrototypeTemplateOffset) |
| 4476 ACCESSORS(FunctionTemplateInfo, parent_template, Object, kParentTemplateOffset) | 4474 ACCESSORS(FunctionTemplateInfo, parent_template, Object, kParentTemplateOffset) |
| 4477 ACCESSORS(FunctionTemplateInfo, named_property_handler, Object, | 4475 ACCESSORS(FunctionTemplateInfo, named_property_handler, Object, |
| 4478 kNamedPropertyHandlerOffset) | 4476 kNamedPropertyHandlerOffset) |
| 4479 ACCESSORS(FunctionTemplateInfo, indexed_property_handler, Object, | 4477 ACCESSORS(FunctionTemplateInfo, indexed_property_handler, Object, |
| 4480 kIndexedPropertyHandlerOffset) | 4478 kIndexedPropertyHandlerOffset) |
| 4481 ACCESSORS(FunctionTemplateInfo, instance_template, Object, | 4479 ACCESSORS(FunctionTemplateInfo, instance_template, Object, |
| 4482 kInstanceTemplateOffset) | 4480 kInstanceTemplateOffset) |
| 4483 ACCESSORS(FunctionTemplateInfo, class_name, Object, kClassNameOffset) | 4481 ACCESSORS(FunctionTemplateInfo, class_name, Object, kClassNameOffset) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4564 SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset) | 4562 SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset) |
| 4565 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, | 4563 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, |
| 4566 kHiddenPrototypeBit) | 4564 kHiddenPrototypeBit) |
| 4567 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) | 4565 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) |
| 4568 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, | 4566 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, |
| 4569 kNeedsAccessCheckBit) | 4567 kNeedsAccessCheckBit) |
| 4570 BOOL_ACCESSORS(FunctionTemplateInfo, flag, read_only_prototype, | 4568 BOOL_ACCESSORS(FunctionTemplateInfo, flag, read_only_prototype, |
| 4571 kReadOnlyPrototypeBit) | 4569 kReadOnlyPrototypeBit) |
| 4572 BOOL_ACCESSORS(FunctionTemplateInfo, flag, remove_prototype, | 4570 BOOL_ACCESSORS(FunctionTemplateInfo, flag, remove_prototype, |
| 4573 kRemovePrototypeBit) | 4571 kRemovePrototypeBit) |
| 4572 BOOL_ACCESSORS(FunctionTemplateInfo, flag, do_not_cache, |
| 4573 kDoNotCacheBit) |
| 4574 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression, | 4574 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression, |
| 4575 kIsExpressionBit) | 4575 kIsExpressionBit) |
| 4576 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel, | 4576 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel, |
| 4577 kIsTopLevelBit) | 4577 kIsTopLevelBit) |
| 4578 | 4578 |
| 4579 BOOL_ACCESSORS(SharedFunctionInfo, | 4579 BOOL_ACCESSORS(SharedFunctionInfo, |
| 4580 compiler_hints, | 4580 compiler_hints, |
| 4581 allows_lazy_compilation, | 4581 allows_lazy_compilation, |
| 4582 kAllowLazyCompilation) | 4582 kAllowLazyCompilation) |
| 4583 BOOL_ACCESSORS(SharedFunctionInfo, | 4583 BOOL_ACCESSORS(SharedFunctionInfo, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4601 SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties, | 4601 SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties, |
| 4602 kExpectedNofPropertiesOffset) | 4602 kExpectedNofPropertiesOffset) |
| 4603 SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset) | 4603 SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset) |
| 4604 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type, | 4604 SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type, |
| 4605 kStartPositionAndTypeOffset) | 4605 kStartPositionAndTypeOffset) |
| 4606 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) | 4606 SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) |
| 4607 SMI_ACCESSORS(SharedFunctionInfo, function_token_position, | 4607 SMI_ACCESSORS(SharedFunctionInfo, function_token_position, |
| 4608 kFunctionTokenPositionOffset) | 4608 kFunctionTokenPositionOffset) |
| 4609 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, | 4609 SMI_ACCESSORS(SharedFunctionInfo, compiler_hints, |
| 4610 kCompilerHintsOffset) | 4610 kCompilerHintsOffset) |
| 4611 SMI_ACCESSORS(SharedFunctionInfo, opt_count, kOptCountOffset) | 4611 SMI_ACCESSORS(SharedFunctionInfo, opt_count_and_bailout_reason, |
| 4612 kOptCountAndBailoutReasonOffset) |
| 4612 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) | 4613 SMI_ACCESSORS(SharedFunctionInfo, counters, kCountersOffset) |
| 4613 | 4614 |
| 4614 #else | 4615 #else |
| 4615 | 4616 |
| 4616 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ | 4617 #define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \ |
| 4617 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ | 4618 STATIC_ASSERT(holder::offset % kPointerSize == 0); \ |
| 4618 int holder::name() { \ | 4619 int holder::name() { \ |
| 4619 int value = READ_INT_FIELD(this, offset); \ | 4620 int value = READ_INT_FIELD(this, offset); \ |
| 4620 ASSERT(kHeapObjectTag == 1); \ | 4621 ASSERT(kHeapObjectTag == 1); \ |
| 4621 ASSERT((value & kHeapObjectTag) == 0); \ | 4622 ASSERT((value & kHeapObjectTag) == 0); \ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4650 start_position_and_type, | 4651 start_position_and_type, |
| 4651 kStartPositionAndTypeOffset) | 4652 kStartPositionAndTypeOffset) |
| 4652 | 4653 |
| 4653 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, | 4654 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, |
| 4654 function_token_position, | 4655 function_token_position, |
| 4655 kFunctionTokenPositionOffset) | 4656 kFunctionTokenPositionOffset) |
| 4656 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, | 4657 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, |
| 4657 compiler_hints, | 4658 compiler_hints, |
| 4658 kCompilerHintsOffset) | 4659 kCompilerHintsOffset) |
| 4659 | 4660 |
| 4660 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, opt_count, kOptCountOffset) | 4661 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, |
| 4662 opt_count_and_bailout_reason, |
| 4663 kOptCountAndBailoutReasonOffset) |
| 4661 | 4664 |
| 4662 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, counters, kCountersOffset) | 4665 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, counters, kCountersOffset) |
| 4663 | 4666 |
| 4664 #endif | 4667 #endif |
| 4665 | 4668 |
| 4666 | 4669 |
| 4667 int SharedFunctionInfo::construction_count() { | 4670 int SharedFunctionInfo::construction_count() { |
| 4668 return READ_BYTE_FIELD(this, kConstructionCountOffset); | 4671 return READ_BYTE_FIELD(this, kConstructionCountOffset); |
| 4669 } | 4672 } |
| 4670 | 4673 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4833 CONDITIONAL_WRITE_BARRIER(GetHeap(), | 4836 CONDITIONAL_WRITE_BARRIER(GetHeap(), |
| 4834 this, | 4837 this, |
| 4835 kScopeInfoOffset, | 4838 kScopeInfoOffset, |
| 4836 reinterpret_cast<Object*>(value), | 4839 reinterpret_cast<Object*>(value), |
| 4837 mode); | 4840 mode); |
| 4838 } | 4841 } |
| 4839 | 4842 |
| 4840 | 4843 |
| 4841 bool SharedFunctionInfo::is_compiled() { | 4844 bool SharedFunctionInfo::is_compiled() { |
| 4842 return code() != | 4845 return code() != |
| 4843 Isolate::Current()->builtins()->builtin(Builtins::kLazyCompile); | 4846 GetIsolate()->builtins()->builtin(Builtins::kLazyCompile); |
| 4844 } | 4847 } |
| 4845 | 4848 |
| 4846 | 4849 |
| 4847 bool SharedFunctionInfo::IsApiFunction() { | 4850 bool SharedFunctionInfo::IsApiFunction() { |
| 4848 return function_data()->IsFunctionTemplateInfo(); | 4851 return function_data()->IsFunctionTemplateInfo(); |
| 4849 } | 4852 } |
| 4850 | 4853 |
| 4851 | 4854 |
| 4852 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { | 4855 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { |
| 4853 ASSERT(IsApiFunction()); | 4856 ASSERT(IsApiFunction()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4897 int SharedFunctionInfo::opt_reenable_tries() { | 4900 int SharedFunctionInfo::opt_reenable_tries() { |
| 4898 return OptReenableTriesBits::decode(counters()); | 4901 return OptReenableTriesBits::decode(counters()); |
| 4899 } | 4902 } |
| 4900 | 4903 |
| 4901 | 4904 |
| 4902 void SharedFunctionInfo::set_opt_reenable_tries(int tries) { | 4905 void SharedFunctionInfo::set_opt_reenable_tries(int tries) { |
| 4903 set_counters(OptReenableTriesBits::update(counters(), tries)); | 4906 set_counters(OptReenableTriesBits::update(counters(), tries)); |
| 4904 } | 4907 } |
| 4905 | 4908 |
| 4906 | 4909 |
| 4910 int SharedFunctionInfo::opt_count() { |
| 4911 return OptCountBits::decode(opt_count_and_bailout_reason()); |
| 4912 } |
| 4913 |
| 4914 |
| 4915 void SharedFunctionInfo::set_opt_count(int opt_count) { |
| 4916 set_opt_count_and_bailout_reason( |
| 4917 OptCountBits::update(opt_count_and_bailout_reason(), opt_count)); |
| 4918 } |
| 4919 |
| 4920 |
| 4921 BailoutReason SharedFunctionInfo::DisableOptimizationReason() { |
| 4922 BailoutReason reason = static_cast<BailoutReason>( |
| 4923 DisabledOptimizationReasonBits::decode(opt_count_and_bailout_reason())); |
| 4924 return reason; |
| 4925 } |
| 4926 |
| 4927 |
| 4907 bool SharedFunctionInfo::has_deoptimization_support() { | 4928 bool SharedFunctionInfo::has_deoptimization_support() { |
| 4908 Code* code = this->code(); | 4929 Code* code = this->code(); |
| 4909 return code->kind() == Code::FUNCTION && code->has_deoptimization_support(); | 4930 return code->kind() == Code::FUNCTION && code->has_deoptimization_support(); |
| 4910 } | 4931 } |
| 4911 | 4932 |
| 4912 | 4933 |
| 4913 void SharedFunctionInfo::TryReenableOptimization() { | 4934 void SharedFunctionInfo::TryReenableOptimization() { |
| 4914 int tries = opt_reenable_tries(); | 4935 int tries = opt_reenable_tries(); |
| 4915 set_opt_reenable_tries((tries + 1) & OptReenableTriesBits::kMax); | 4936 set_opt_reenable_tries((tries + 1) & OptReenableTriesBits::kMax); |
| 4916 // We reenable optimization whenever the number of tries is a large | 4937 // We reenable optimization whenever the number of tries is a large |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4997 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; | 5018 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; |
| 4998 | 5019 |
| 4999 set_code(code); | 5020 set_code(code); |
| 5000 | 5021 |
| 5001 // Add/remove the function from the list of optimized functions for this | 5022 // Add/remove the function from the list of optimized functions for this |
| 5002 // context based on the state change. | 5023 // context based on the state change. |
| 5003 if (!was_optimized && is_optimized) { | 5024 if (!was_optimized && is_optimized) { |
| 5004 context()->native_context()->AddOptimizedFunction(this); | 5025 context()->native_context()->AddOptimizedFunction(this); |
| 5005 } | 5026 } |
| 5006 if (was_optimized && !is_optimized) { | 5027 if (was_optimized && !is_optimized) { |
| 5028 // TODO(titzer): linear in the number of optimized functions; fix! |
| 5007 context()->native_context()->RemoveOptimizedFunction(this); | 5029 context()->native_context()->RemoveOptimizedFunction(this); |
| 5008 } | 5030 } |
| 5009 } | 5031 } |
| 5010 | 5032 |
| 5011 | 5033 |
| 5012 Context* JSFunction::context() { | 5034 Context* JSFunction::context() { |
| 5013 return Context::cast(READ_FIELD(this, kContextOffset)); | 5035 return Context::cast(READ_FIELD(this, kContextOffset)); |
| 5014 } | 5036 } |
| 5015 | 5037 |
| 5016 | 5038 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5259 | 5281 |
| 5260 | 5282 |
| 5261 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { | 5283 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { |
| 5262 ASSERT(kind() == FUNCTION); | 5284 ASSERT(kind() == FUNCTION); |
| 5263 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); | 5285 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); |
| 5264 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, | 5286 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, |
| 5265 value, mode); | 5287 value, mode); |
| 5266 } | 5288 } |
| 5267 | 5289 |
| 5268 | 5290 |
| 5291 Object* Code::next_code_link() { |
| 5292 CHECK(kind() == OPTIMIZED_FUNCTION); |
| 5293 return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset)); |
| 5294 } |
| 5295 |
| 5296 |
| 5297 void Code::set_next_code_link(Object* value, WriteBarrierMode mode) { |
| 5298 CHECK(kind() == OPTIMIZED_FUNCTION); |
| 5299 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); |
| 5300 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, |
| 5301 value, mode); |
| 5302 } |
| 5303 |
| 5304 |
| 5269 int Code::stub_info() { | 5305 int Code::stub_info() { |
| 5270 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC || | 5306 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC || |
| 5271 kind() == BINARY_OP_IC || kind() == LOAD_IC); | 5307 kind() == BINARY_OP_IC || kind() == LOAD_IC); |
| 5272 Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset); | 5308 Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset); |
| 5273 return Smi::cast(value)->value(); | 5309 return Smi::cast(value)->value(); |
| 5274 } | 5310 } |
| 5275 | 5311 |
| 5276 | 5312 |
| 5277 void Code::set_stub_info(int value) { | 5313 void Code::set_stub_info(int value) { |
| 5278 ASSERT(kind() == COMPARE_IC || | 5314 ASSERT(kind() == COMPARE_IC || |
| 5279 kind() == COMPARE_NIL_IC || | 5315 kind() == COMPARE_NIL_IC || |
| 5280 kind() == BINARY_OP_IC || | 5316 kind() == BINARY_OP_IC || |
| 5281 kind() == STUB || | 5317 kind() == STUB || |
| 5282 kind() == LOAD_IC || | 5318 kind() == LOAD_IC || |
| 5283 kind() == KEYED_LOAD_IC || | 5319 kind() == KEYED_LOAD_IC || |
| 5284 kind() == STORE_IC || | 5320 kind() == STORE_IC || |
| 5285 kind() == KEYED_STORE_IC); | 5321 kind() == KEYED_STORE_IC); |
| 5286 WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value)); | 5322 WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value)); |
| 5287 } | 5323 } |
| 5288 | 5324 |
| 5289 | 5325 |
| 5290 Object* Code::code_to_deoptimize_link() { | |
| 5291 // Optimized code should not have type feedback. | |
| 5292 ASSERT(kind() == OPTIMIZED_FUNCTION); | |
| 5293 return READ_FIELD(this, kTypeFeedbackInfoOffset); | |
| 5294 } | |
| 5295 | |
| 5296 | |
| 5297 void Code::set_code_to_deoptimize_link(Object* value) { | |
| 5298 ASSERT(kind() == OPTIMIZED_FUNCTION); | |
| 5299 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); | |
| 5300 } | |
| 5301 | |
| 5302 | |
| 5303 Object** Code::code_to_deoptimize_link_slot() { | |
| 5304 ASSERT(kind() == OPTIMIZED_FUNCTION); | |
| 5305 return HeapObject::RawField(this, kTypeFeedbackInfoOffset); | |
| 5306 } | |
| 5307 | |
| 5308 | |
| 5309 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset) | 5326 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset) |
| 5310 INT_ACCESSORS(Code, ic_age, kICAgeOffset) | 5327 INT_ACCESSORS(Code, ic_age, kICAgeOffset) |
| 5311 | 5328 |
| 5312 | 5329 |
| 5313 byte* Code::instruction_start() { | 5330 byte* Code::instruction_start() { |
| 5314 return FIELD_ADDR(this, kHeaderSize); | 5331 return FIELD_ADDR(this, kHeaderSize); |
| 5315 } | 5332 } |
| 5316 | 5333 |
| 5317 | 5334 |
| 5318 byte* Code::instruction_end() { | 5335 byte* Code::instruction_end() { |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6175 | 6192 |
| 6176 | 6193 |
| 6177 ACCESSORS(TypeFeedbackInfo, type_feedback_cells, TypeFeedbackCells, | 6194 ACCESSORS(TypeFeedbackInfo, type_feedback_cells, TypeFeedbackCells, |
| 6178 kTypeFeedbackCellsOffset) | 6195 kTypeFeedbackCellsOffset) |
| 6179 | 6196 |
| 6180 | 6197 |
| 6181 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) | 6198 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) |
| 6182 | 6199 |
| 6183 | 6200 |
| 6184 Relocatable::Relocatable(Isolate* isolate) { | 6201 Relocatable::Relocatable(Isolate* isolate) { |
| 6185 ASSERT(isolate == Isolate::Current()); | |
| 6186 isolate_ = isolate; | 6202 isolate_ = isolate; |
| 6187 prev_ = isolate->relocatable_top(); | 6203 prev_ = isolate->relocatable_top(); |
| 6188 isolate->set_relocatable_top(this); | 6204 isolate->set_relocatable_top(this); |
| 6189 } | 6205 } |
| 6190 | 6206 |
| 6191 | 6207 |
| 6192 Relocatable::~Relocatable() { | 6208 Relocatable::~Relocatable() { |
| 6193 ASSERT(isolate_ == Isolate::Current()); | |
| 6194 ASSERT_EQ(isolate_->relocatable_top(), this); | 6209 ASSERT_EQ(isolate_->relocatable_top(), this); |
| 6195 isolate_->set_relocatable_top(prev_); | 6210 isolate_->set_relocatable_top(prev_); |
| 6196 } | 6211 } |
| 6197 | 6212 |
| 6198 | 6213 |
| 6199 int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) { | 6214 int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) { |
| 6200 return map->instance_size(); | 6215 return map->instance_size(); |
| 6201 } | 6216 } |
| 6202 | 6217 |
| 6203 | 6218 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6285 #undef WRITE_UINT32_FIELD | 6300 #undef WRITE_UINT32_FIELD |
| 6286 #undef READ_SHORT_FIELD | 6301 #undef READ_SHORT_FIELD |
| 6287 #undef WRITE_SHORT_FIELD | 6302 #undef WRITE_SHORT_FIELD |
| 6288 #undef READ_BYTE_FIELD | 6303 #undef READ_BYTE_FIELD |
| 6289 #undef WRITE_BYTE_FIELD | 6304 #undef WRITE_BYTE_FIELD |
| 6290 | 6305 |
| 6291 | 6306 |
| 6292 } } // namespace v8::internal | 6307 } } // namespace v8::internal |
| 6293 | 6308 |
| 6294 #endif // V8_OBJECTS_INL_H_ | 6309 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |