Change the check for builtin functions to not be based on identity,
authorkasperl@chromium.org <kasperl@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 29 Jul 2009 09:51:41 +0000 (09:51 +0000)
committerkasperl@chromium.org <kasperl@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 29 Jul 2009 09:51:41 +0000 (09:51 +0000)
which seems shaky in the presence of multiple builtin objects.
Review URL: http://codereview.chromium.org/159583

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2573 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/debug.cc
src/objects-inl.h
src/objects.h

index be18cbf..18536f5 100644 (file)
@@ -1301,7 +1301,7 @@ void Debug::HandleStepIn(Handle<JSFunction> function,
   // step into was requested.
   if (fp == Debug::step_in_fp()) {
     // Don't allow step into functions in the native context.
-    if (function->context()->global() != Top::context()->builtins()) {
+    if (!function->IsBuiltin()) {
       if (function->shared()->code() ==
           Builtins::builtin(Builtins::FunctionApply) ||
           function->shared()->code() ==
@@ -1311,8 +1311,7 @@ void Debug::HandleStepIn(Handle<JSFunction> function,
         // Builtins::FunctionCall. The receiver of call/apply is the target
         // function.
         if (!holder.is_null() && holder->IsJSFunction() &&
-            JSFunction::cast(*holder)->context()->global() !=
-            Top::context()->builtins()) {
+            !JSFunction::cast(*holder)->IsBuiltin()) {
           Handle<SharedFunctionInfo> shared_info(
               JSFunction::cast(*holder)->shared());
           Debug::FloodWithOneShot(shared_info);
index 0b5e073..b000dcf 100644 (file)
@@ -2341,6 +2341,11 @@ bool JSFunction::IsBoilerplate() {
 }
 
 
+bool JSFunction::IsBuiltin() {
+  return context()->global()->IsJSBuiltinsObject();
+}
+
+
 bool JSObject::IsLoaded() {
   return !map()->needs_loading();
 }
index 64e6b36..7c30517 100644 (file)
@@ -3175,6 +3175,9 @@ class JSFunction: public JSObject {
   // function.
   inline bool IsBoilerplate();
 
+  // Tells whether this function is builtin.
+  inline bool IsBuiltin();
+
   // [literals]: Fixed array holding the materialized literals.
   //
   // If the function contains object, regexp or array literals, the