Revision: 2579
Author: [email protected]
Date: Wed Jul 29 07:41:59 2009
Log: Merge r2578 to branches/1.2.
Review URL: http://codereview.chromium.org/159588
http://code.google.com/p/v8/source/detail?r=2579
Modified:
/branches/1.2/src/builtins.cc
/branches/1.2/src/version.cc
=======================================
--- /branches/1.2/src/builtins.cc Tue Jun 16 02:43:10 2009
+++ /branches/1.2/src/builtins.cc Wed Jul 29 07:41:59 2009
@@ -87,17 +87,33 @@
}
-// TODO(1238487): Get rid of this function that determines if the
-// builtin is called as a constructor. This may be a somewhat slow
-// operation due to the stack frame iteration.
static inline bool CalledAsConstructor() {
+#ifdef DEBUG
+ // Calculate the result using a full stack frame iterator and check
+ // that the state of the stack is as we assume it to be in the
+ // code below.
StackFrameIterator it;
ASSERT(it.frame()->is_exit());
it.Advance();
StackFrame* frame = it.frame();
- return frame->is_construct();
-}
-
+ bool reference_result = frame->is_construct();
+#endif
+ Address fp = Top::c_entry_fp(Top::GetCurrentThread());
+ // Because we know fp points to an exit frame we can use the relevant
+ // part of ExitFrame::ComputeCallerState directly.
+ const int kCallerOffset = ExitFrameConstants::kCallerFPOffset;
+ Address caller_fp = Memory::Address_at(fp + kCallerOffset);
+ // This inlines the part of StackFrame::ComputeType that grabs the
+ // type of the current frame. Note that StackFrame::ComputeType
+ // has been specialized for each architecture so if any one of them
+ // changes this code has to be changed as well.
+ const int kMarkerOffset = StandardFrameConstants::kMarkerOffset;
+ const Smi* kConstructMarker = Smi::FromInt(StackFrame::CONSTRUCT);
+ Object* marker = Memory::Object_at(caller_fp + kMarkerOffset);
+ bool result = (marker == kConstructMarker);
+ ASSERT_EQ(result, reference_result);
+ return result;
+}
//
----------------------------------------------------------------------------
=======================================
--- /branches/1.2/src/version.cc Wed Jul 29 05:04:55 2009
+++ /branches/1.2/src/version.cc Wed Jul 29 07:41:59 2009
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 1
#define MINOR_VERSION 2
#define BUILD_NUMBER 14
-#define PATCH_LEVEL 13
+#define PATCH_LEVEL 14
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---