OLD | NEW |
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 5547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5558 // We reenable optimization whenever the number of tries is a large | 5558 // We reenable optimization whenever the number of tries is a large |
5559 // enough power of 2. | 5559 // enough power of 2. |
5560 if (tries >= 16 && (((tries - 1) & tries) == 0)) { | 5560 if (tries >= 16 && (((tries - 1) & tries) == 0)) { |
5561 set_optimization_disabled(false); | 5561 set_optimization_disabled(false); |
5562 set_opt_count(0); | 5562 set_opt_count(0); |
5563 set_deopt_count(0); | 5563 set_deopt_count(0); |
5564 } | 5564 } |
5565 } | 5565 } |
5566 | 5566 |
5567 | 5567 |
| 5568 bool SharedFunctionInfo::IsSubjectToDebugging() { |
| 5569 Object* script_obj = script(); |
| 5570 if (script_obj->IsUndefined()) return false; |
| 5571 Script* script = Script::cast(script_obj); |
| 5572 Script::Type type = static_cast<Script::Type>(script->type()->value()); |
| 5573 return type == Script::TYPE_NORMAL; |
| 5574 } |
| 5575 |
| 5576 |
5568 bool JSFunction::IsBuiltin() { | 5577 bool JSFunction::IsBuiltin() { |
5569 return context()->global_object()->IsJSBuiltinsObject(); | 5578 return context()->global_object()->IsJSBuiltinsObject(); |
5570 } | 5579 } |
5571 | 5580 |
5572 | 5581 |
5573 bool JSFunction::IsFromNativeScript() { | 5582 bool JSFunction::IsSubjectToDebugging() { |
5574 Object* script = shared()->script(); | 5583 return shared()->IsSubjectToDebugging(); |
5575 bool native = script->IsScript() && | |
5576 Script::cast(script)->type()->value() == Script::TYPE_NATIVE; | |
5577 DCHECK(!IsBuiltin() || native); // All builtins are also native. | |
5578 return native; | |
5579 } | 5584 } |
5580 | 5585 |
5581 | 5586 |
5582 bool JSFunction::IsFromExtensionScript() { | |
5583 Object* script = shared()->script(); | |
5584 return script->IsScript() && | |
5585 Script::cast(script)->type()->value() == Script::TYPE_EXTENSION; | |
5586 } | |
5587 | |
5588 | |
5589 bool JSFunction::IsSubjectToDebugging() { | |
5590 return !IsFromNativeScript() && !IsFromExtensionScript(); | |
5591 } | |
5592 | |
5593 | |
5594 bool JSFunction::NeedsArgumentsAdaption() { | 5587 bool JSFunction::NeedsArgumentsAdaption() { |
5595 return shared()->internal_formal_parameter_count() != | 5588 return shared()->internal_formal_parameter_count() != |
5596 SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 5589 SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
5597 } | 5590 } |
5598 | 5591 |
5599 | 5592 |
5600 bool JSFunction::IsOptimized() { | 5593 bool JSFunction::IsOptimized() { |
5601 return code()->kind() == Code::OPTIMIZED_FUNCTION; | 5594 return code()->kind() == Code::OPTIMIZED_FUNCTION; |
5602 } | 5595 } |
5603 | 5596 |
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7296 #undef READ_SHORT_FIELD | 7289 #undef READ_SHORT_FIELD |
7297 #undef WRITE_SHORT_FIELD | 7290 #undef WRITE_SHORT_FIELD |
7298 #undef READ_BYTE_FIELD | 7291 #undef READ_BYTE_FIELD |
7299 #undef WRITE_BYTE_FIELD | 7292 #undef WRITE_BYTE_FIELD |
7300 #undef NOBARRIER_READ_BYTE_FIELD | 7293 #undef NOBARRIER_READ_BYTE_FIELD |
7301 #undef NOBARRIER_WRITE_BYTE_FIELD | 7294 #undef NOBARRIER_WRITE_BYTE_FIELD |
7302 | 7295 |
7303 } } // namespace v8::internal | 7296 } } // namespace v8::internal |
7304 | 7297 |
7305 #endif // V8_OBJECTS_INL_H_ | 7298 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |