Optimized String.prototype.match.

Improved the stack information in profiles.

Fixed bug in ARM port making it possible to compile the runtime system for thumb mode again.

Implemented a number of optimizations in the code generator.

Fixed a number of memory leaks in tests.

Fixed crash bug in connection with script source code and external strings.



git-svn-id: http://v8.googlecode.com/svn/trunk@1642 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/frames.cc b/src/frames.cc
index 763ff48..a7da25a 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -230,6 +230,25 @@
 
 bool SafeStackFrameIterator::IsValidCaller(StackFrame* frame) {
   StackFrame::State state;
+  if (frame->is_entry() || frame->is_entry_construct()) {
+    // See EntryFrame::GetCallerState. It computes the caller FP address
+    // and calls ExitFrame::GetStateForFramePointer on it. We need to be
+    // sure that caller FP address is valid.
+    Address caller_fp = Memory::Address_at(
+        frame->fp() + EntryFrameConstants::kCallerFPOffset);
+    if (!IsValidStackAddress(caller_fp)) {
+      return false;
+    }
+  } else if (frame->is_arguments_adaptor()) {
+    // See ArgumentsAdaptorFrame::GetCallerStackPointer. It assumes that
+    // the number of arguments is stored on stack as Smi. We need to check
+    // that it really an Smi.
+    Object* number_of_args = reinterpret_cast<ArgumentsAdaptorFrame*>(frame)->
+        GetExpression(0);
+    if (!number_of_args->IsSmi()) {
+      return false;
+    }
+  }
   frame->ComputeCallerState(&state);
   return IsValidStackAddress(state.sp) && IsValidStackAddress(state.fp) &&
       iterator_.SingletonFor(frame->GetCallerState(&state)) != NULL;