void Debug::FloodWithOneShot(Handle<JSFunction> function,
BreakLocatorType type) {
- // Do not ever break in native and extension functions.
- if (!function->IsSubjectToDebugging()) return;
-
PrepareForBreakPoints();
// Make sure the function is compiled and has set up the debug info.
Handle<Object> bindee(new_bindings->get(JSFunction::kBoundFunctionIndex),
isolate_);
- if (!bindee.is_null() && bindee->IsJSFunction() &&
- JSFunction::cast(*bindee)->IsSubjectToDebugging()) {
+ if (!bindee.is_null() && bindee->IsJSFunction()) {
Handle<JSFunction> bindee_function(JSFunction::cast(*bindee));
FloodWithOneShotGeneric(bindee_function);
}
// Ensures the debug information is present for shared.
bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
Handle<JSFunction> function) {
- Isolate* isolate = shared->GetIsolate();
+ if (!shared->IsSubjectToDebugging()) return false;
// Return if we already have the debug info for shared.
if (HasDebugInfo(shared)) {
DCHECK(shared->is_compiled());
+ DCHECK(shared->code()->has_debug_break_slots());
return true;
}
// There will be at least one break point when we are done.
has_break_points_ = true;
- // Ensure function is compiled. Return false if this failed.
- if (!function.is_null() &&
- !Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) {
+ if (function.is_null()) {
+ DCHECK(shared->is_compiled());
+ DCHECK(shared->code()->has_debug_break_slots());
+ } else if (!Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) {
return false;
}
shared->feedback_vector()->ClearICSlots(*shared);
// Create the debug info object.
- Handle<DebugInfo> debug_info = isolate->factory()->NewDebugInfo(shared);
+ DCHECK(shared->is_compiled());
+ DCHECK(shared->code()->has_debug_break_slots());
+ Handle<DebugInfo> debug_info = isolate_->factory()->NewDebugInfo(shared);
// Add debug info to the list.
DebugInfoListNode* node = new DebugInfoListNode(*debug_info);
}
-bool JSFunction::IsBuiltin() {
- return context()->global_object()->IsJSBuiltinsObject();
+bool SharedFunctionInfo::IsSubjectToDebugging() {
+ Object* script_obj = script();
+ if (script_obj->IsUndefined()) return false;
+ Script* script = Script::cast(script_obj);
+ Script::Type type = static_cast<Script::Type>(script->type()->value());
+ return type == Script::TYPE_NORMAL;
}
-bool JSFunction::IsFromNativeScript() {
- Object* script = shared()->script();
- bool native = script->IsScript() &&
- Script::cast(script)->type()->value() == Script::TYPE_NATIVE;
- DCHECK(!IsBuiltin() || native); // All builtins are also native.
- return native;
-}
-
-
-bool JSFunction::IsFromExtensionScript() {
- Object* script = shared()->script();
- return script->IsScript() &&
- Script::cast(script)->type()->value() == Script::TYPE_EXTENSION;
+bool JSFunction::IsBuiltin() {
+ return context()->global_object()->IsJSBuiltinsObject();
}
bool JSFunction::IsSubjectToDebugging() {
- return !IsFromNativeScript() && !IsFromExtensionScript();
+ return shared()->IsSubjectToDebugging();
}
reason));
}
+ // Tells whether this function should be subject to debugging.
+ inline bool IsSubjectToDebugging();
+
// Check whether or not this function is inlineable.
bool IsInlineable();
// Tells whether this function is builtin.
inline bool IsBuiltin();
- // Tells whether this function is defined in a native script.
- inline bool IsFromNativeScript();
-
- // Tells whether this function is defined in an extension script.
- inline bool IsFromExtensionScript();
-
// Tells whether this function should be subject to debugging.
inline bool IsSubjectToDebugging();