Commit 439f3e67 authored by ager@chromium.org's avatar ager@chromium.org

Do not put failures in handles.

Assert in the Handle constructor that the object is not a failure.

I have run our own tests in debug mode and the WebKit layout tests in
debug mode and there are no regressions.
Review URL: http://codereview.chromium.org/9114

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@691 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a62c6788
......@@ -4044,7 +4044,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
// sets it to 0 to signal the existence of the JSEntry frame.
__ mov(ip, Operand(Top::pending_exception_address()));
__ str(r0, MemOperand(ip));
__ mov(r0, Operand(Handle<Failure>(Failure::Exception())));
__ mov(r0, Operand(reinterpret_cast<int32_t>(Failure::Exception())));
__ b(&exit);
// Invoke: Link this frame into the handler chain.
......
......@@ -5046,7 +5046,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
// exception field in the JSEnv and return a failure sentinel.
ExternalReference pending_exception(Top::k_pending_exception_address);
__ mov(Operand::StaticVariable(pending_exception), eax);
__ mov(eax, Handle<Failure>(Failure::Exception()));
__ mov(eax, reinterpret_cast<int32_t>(Failure::Exception()));
__ jmp(&exit);
// Invoke: Link this frame into the handler chain.
......
......@@ -96,16 +96,14 @@ static Handle<Object> Invoke(bool construct,
ASSERT(*has_pending_exception == Top::has_pending_exception());
if (*has_pending_exception) {
Top::setup_external_caught();
}
// If the pending exception is OutOfMemoryException set out_of_memory in
// the global context. Note: We have to mark the global context here
// since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to
// set it.
if (*has_pending_exception) {
// If the pending exception is OutOfMemoryException set out_of_memory in
// the global context. Note: We have to mark the global context here
// since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to
// set it.
if (Top::pending_exception() == Failure::OutOfMemoryException()) {
Top::context()->mark_out_of_memory();
}
return Handle<Object>();
}
return Handle<Object>(value);
......
......@@ -36,6 +36,7 @@ namespace v8 { namespace internal {
template<class T>
Handle<T>::Handle(T* obj) {
ASSERT(!obj->IsFailure());
location_ = reinterpret_cast<T**>(HandleScope::CreateHandle(obj));
}
......
......@@ -382,7 +382,8 @@ Handle<Object> RegExpImpl::JsreCompile(Handle<JSRegExp> re,
(error_message == NULL) ? "Unknown regexp error" : error_message)));
Handle<Object> regexp_err =
Factory::NewSyntaxError("malformed_regexp", array);
return Handle<Object>(Top::Throw(*regexp_err));
Top::Throw(*regexp_err);
return Handle<Object>();
}
// Convert the return address to a ByteArray pointer.
......
......@@ -108,13 +108,12 @@ Handle<Object> MessageHandler::MakeMessageObject(
Handle<Object> message =
Execution::Call(fun, Factory::undefined_value(), argc, argv,
&caught_exception);
if (caught_exception) {
// If creating the message (in JS code) resulted in an exception, we
// skip doing the callback. This usually only happens in case of
// stack overflow exceptions being thrown by the parser when the
// stack is almost full.
if (caught_exception) return Handle<Object>();
}
// If creating the message (in JS code) resulted in an exception, we
// skip doing the callback. This usually only happens in case of
// stack overflow exceptions being thrown by the parser when the
// stack is almost full.
if (caught_exception) return Handle<Object>();
return message.EscapeFrom(&scope);
}
......
......@@ -199,11 +199,11 @@ Object* Object::GetPropertyWithCallback(Object* receiver,
Handle<JSFunction> fun(JSFunction::cast(getter));
Handle<Object> self(receiver);
bool has_pending_exception;
Object* result =
*Execution::Call(fun, self, 0, NULL, &has_pending_exception);
Handle<Object> result =
Execution::Call(fun, self, 0, NULL, &has_pending_exception);
// Check for pending exception and return the result.
if (has_pending_exception) return Failure::Exception();
return result;
return *result;
}
// Getter is not a function.
return Heap::undefined_value();
......
......@@ -296,7 +296,9 @@ static Object* Runtime_RegExpCompile(Arguments args) {
Handle<String> pattern(raw_pattern);
CONVERT_CHECKED(String, raw_flags, args[2]);
Handle<String> flags(raw_flags);
return *RegExpImpl::Compile(re, pattern, flags);
Handle<Object> result = RegExpImpl::Compile(re, pattern, flags);
if (result.is_null()) return Failure::Exception();
return *result;
}
......@@ -5396,6 +5398,7 @@ static Object* Runtime_DebugEvaluate(Arguments args) {
Handle<Object> evaluation_function =
Execution::Call(compiled_function, receiver, 0, NULL,
&has_pending_exception);
if (has_pending_exception) return Failure::Exception();
Handle<Object> arguments = GetArgumentsObject(frame, function, code, &sinfo,
function_context);
......@@ -5407,6 +5410,7 @@ static Object* Runtime_DebugEvaluate(Arguments args) {
Handle<Object> result =
Execution::Call(Handle<JSFunction>::cast(evaluation_function), receiver,
argc, argv, &has_pending_exception);
if (has_pending_exception) return Failure::Exception();
return *result;
}
......@@ -5452,6 +5456,7 @@ static Object* Runtime_DebugEvaluateGlobal(Arguments args) {
Handle<Object> result =
Execution::Call(compiled_function, receiver, 0, NULL,
&has_pending_exception);
if (has_pending_exception) return Failure::Exception();
return *result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment