Commit 0dcaac19 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Make Failure inherit from MaybeObject instead of Object.

Review URL: http://codereview.chromium.org/3970005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5698 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a21fc8e2
This diff is collapsed.
...@@ -75,40 +75,44 @@ class Accessors : public AllStatic { ...@@ -75,40 +75,44 @@ class Accessors : public AllStatic {
}; };
// Accessor functions called directly from the runtime system. // Accessor functions called directly from the runtime system.
MUST_USE_RESULT static Object* FunctionGetPrototype(Object* object, void*); MUST_USE_RESULT static MaybeObject* FunctionGetPrototype(Object* object,
MUST_USE_RESULT static Object* FunctionSetPrototype(JSObject* object, void*);
Object* value, MUST_USE_RESULT static MaybeObject* FunctionSetPrototype(JSObject* object,
void*); Object* value,
void*);
private: private:
// Accessor functions only used through the descriptor. // Accessor functions only used through the descriptor.
static Object* FunctionGetLength(Object* object, void*); static MaybeObject* FunctionGetLength(Object* object, void*);
static Object* FunctionGetName(Object* object, void*); static MaybeObject* FunctionGetName(Object* object, void*);
static Object* FunctionGetArguments(Object* object, void*); static MaybeObject* FunctionGetArguments(Object* object, void*);
static Object* FunctionGetCaller(Object* object, void*); static MaybeObject* FunctionGetCaller(Object* object, void*);
static Object* ArraySetLength(JSObject* object, Object* value, void*); MUST_USE_RESULT static MaybeObject* ArraySetLength(JSObject* object,
static Object* ArrayGetLength(Object* object, void*); Object* value, void*);
static Object* StringGetLength(Object* object, void*); static MaybeObject* ArrayGetLength(Object* object, void*);
static Object* ScriptGetName(Object* object, void*); static MaybeObject* StringGetLength(Object* object, void*);
static Object* ScriptGetId(Object* object, void*); static MaybeObject* ScriptGetName(Object* object, void*);
static Object* ScriptGetSource(Object* object, void*); static MaybeObject* ScriptGetId(Object* object, void*);
static Object* ScriptGetLineOffset(Object* object, void*); static MaybeObject* ScriptGetSource(Object* object, void*);
static Object* ScriptGetColumnOffset(Object* object, void*); static MaybeObject* ScriptGetLineOffset(Object* object, void*);
static Object* ScriptGetData(Object* object, void*); static MaybeObject* ScriptGetColumnOffset(Object* object, void*);
static Object* ScriptGetType(Object* object, void*); static MaybeObject* ScriptGetData(Object* object, void*);
static Object* ScriptGetCompilationType(Object* object, void*); static MaybeObject* ScriptGetType(Object* object, void*);
static Object* ScriptGetLineEnds(Object* object, void*); static MaybeObject* ScriptGetCompilationType(Object* object, void*);
static Object* ScriptGetContextData(Object* object, void*); static MaybeObject* ScriptGetLineEnds(Object* object, void*);
static Object* ScriptGetEvalFromScript(Object* object, void*); static MaybeObject* ScriptGetContextData(Object* object, void*);
static Object* ScriptGetEvalFromScriptPosition(Object* object, void*); static MaybeObject* ScriptGetEvalFromScript(Object* object, void*);
static Object* ScriptGetEvalFromFunctionName(Object* object, void*); static MaybeObject* ScriptGetEvalFromScriptPosition(Object* object, void*);
static Object* ObjectGetPrototype(Object* receiver, void*); static MaybeObject* ScriptGetEvalFromFunctionName(Object* object, void*);
static Object* ObjectSetPrototype(JSObject* receiver, Object* value, void*); static MaybeObject* ObjectGetPrototype(Object* receiver, void*);
static MaybeObject* ObjectSetPrototype(JSObject* receiver,
Object* value,
void*);
// Helper functions. // Helper functions.
static Object* FlattenNumber(Object* value); static Object* FlattenNumber(Object* value);
static Object* IllegalSetter(JSObject*, Object*, void*); static MaybeObject* IllegalSetter(JSObject*, Object*, void*);
static Object* IllegalGetAccessor(Object* object, void*); static Object* IllegalGetAccessor(Object* object, void*);
static Object* ReadOnlySetAccessor(JSObject*, Object* value, void*); static MaybeObject* ReadOnlySetAccessor(JSObject*, Object* value, void*);
}; };
} } // namespace v8::internal } } // namespace v8::internal
......
...@@ -1507,7 +1507,8 @@ static i::Handle<i::Object> CallV8HeapFunction(const char* name, ...@@ -1507,7 +1507,8 @@ static i::Handle<i::Object> CallV8HeapFunction(const char* name,
i::Object** argv[], i::Object** argv[],
bool* has_pending_exception) { bool* has_pending_exception) {
i::Handle<i::String> fmt_str = i::Factory::LookupAsciiSymbol(name); i::Handle<i::String> fmt_str = i::Factory::LookupAsciiSymbol(name);
i::Object* object_fun = i::Top::builtins()->GetProperty(*fmt_str); i::Object* object_fun =
i::Top::builtins()->GetPropertyNoExceptionThrown(*fmt_str);
i::Handle<i::JSFunction> fun = i::Handle<i::JSFunction> fun =
i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun)); i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun));
i::Handle<i::Object> value = i::Handle<i::Object> value =
...@@ -1623,7 +1624,8 @@ Local<StackFrame> StackTrace::GetFrame(uint32_t index) const { ...@@ -1623,7 +1624,8 @@ Local<StackFrame> StackTrace::GetFrame(uint32_t index) const {
ENTER_V8; ENTER_V8;
HandleScope scope; HandleScope scope;
i::Handle<i::JSArray> self = Utils::OpenHandle(this); i::Handle<i::JSArray> self = Utils::OpenHandle(this);
i::Handle<i::JSObject> obj(i::JSObject::cast(self->GetElement(index))); i::Object* raw_object = self->GetElementNoExceptionThrown(index);
i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object));
return scope.Close(Utils::StackFrameToLocal(obj)); return scope.Close(Utils::StackFrameToLocal(obj));
} }
...@@ -2539,10 +2541,12 @@ Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( ...@@ -2539,10 +2541,12 @@ Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup); self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup);
if (lookup.IsProperty()) { if (lookup.IsProperty()) {
PropertyAttributes attributes; PropertyAttributes attributes;
i::Handle<i::Object> result(self_obj->GetProperty(*self_obj, i::Object* property =
&lookup, self_obj->GetProperty(*self_obj,
*key_obj, &lookup,
&attributes)); *key_obj,
&attributes)->ToObjectUnchecked();
i::Handle<i::Object> result(property);
return Utils::ToLocal(result); return Utils::ToLocal(result);
} }
return Local<Value>(); // No real property was found in prototype chain. return Local<Value>(); // No real property was found in prototype chain.
...@@ -2558,10 +2562,12 @@ Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { ...@@ -2558,10 +2562,12 @@ Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) {
self_obj->LookupRealNamedProperty(*key_obj, &lookup); self_obj->LookupRealNamedProperty(*key_obj, &lookup);
if (lookup.IsProperty()) { if (lookup.IsProperty()) {
PropertyAttributes attributes; PropertyAttributes attributes;
i::Handle<i::Object> result(self_obj->GetProperty(*self_obj, i::Object* property =
&lookup, self_obj->GetProperty(*self_obj,
*key_obj, &lookup,
&attributes)); *key_obj,
&attributes)->ToObjectUnchecked();
i::Handle<i::Object> result(property);
return Utils::ToLocal(result); return Utils::ToLocal(result);
} }
return Local<Value>(); // No real property was found in prototype chain. return Local<Value>(); // No real property was found in prototype chain.
......
...@@ -1030,7 +1030,7 @@ int RegExpMacroAssemblerARM::CheckStackGuardState(Address* return_address, ...@@ -1030,7 +1030,7 @@ int RegExpMacroAssemblerARM::CheckStackGuardState(Address* return_address,
ASSERT(*return_address <= ASSERT(*return_address <=
re_code->instruction_start() + re_code->instruction_size()); re_code->instruction_start() + re_code->instruction_size());
Object* result = Execution::HandleStackGuardInterrupt(); MaybeObject* result = Execution::HandleStackGuardInterrupt();
if (*code_handle != re_code) { // Return address no longer valid if (*code_handle != re_code) { // Return address no longer valid
int delta = *code_handle - re_code; int delta = *code_handle - re_code;
......
This diff is collapsed.
...@@ -1009,11 +1009,10 @@ bool Genesis::CompileScriptCached(Vector<const char> name, ...@@ -1009,11 +1009,10 @@ bool Genesis::CompileScriptCached(Vector<const char> name,
} }
#define INSTALL_NATIVE(Type, name, var) \ #define INSTALL_NATIVE(Type, name, var) \
Handle<String> var##_name = Factory::LookupAsciiSymbol(name); \ Handle<String> var##_name = Factory::LookupAsciiSymbol(name); \
global_context()->set_##var(Type::cast(global_context()-> \ global_context()->set_##var(Type::cast( \
builtins()-> \ global_context()->builtins()->GetPropertyNoExceptionThrown(*var##_name)));
GetProperty(*var##_name)));
void Genesis::InstallNativeFunctions() { void Genesis::InstallNativeFunctions() {
HandleScope scope; HandleScope scope;
...@@ -1369,7 +1368,8 @@ static void InstallCustomCallGenerator(Handle<JSObject> holder, ...@@ -1369,7 +1368,8 @@ static void InstallCustomCallGenerator(Handle<JSObject> holder,
const char* function_name, const char* function_name,
int id) { int id) {
Handle<String> name = Factory::LookupAsciiSymbol(function_name); Handle<String> name = Factory::LookupAsciiSymbol(function_name);
Handle<JSFunction> function(JSFunction::cast(holder->GetProperty(*name))); Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
Handle<JSFunction> function(JSFunction::cast(function_object));
function->shared()->set_function_data(Smi::FromInt(id)); function->shared()->set_function_data(Smi::FromInt(id));
} }
...@@ -1584,8 +1584,9 @@ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) { ...@@ -1584,8 +1584,9 @@ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
Handle<String> name = Factory::LookupAsciiSymbol(Builtins::GetName(id)); Handle<String> name = Factory::LookupAsciiSymbol(Builtins::GetName(id));
Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
Handle<JSFunction> function Handle<JSFunction> function
= Handle<JSFunction>(JSFunction::cast(builtins->GetProperty(*name))); = Handle<JSFunction>(JSFunction::cast(function_object));
builtins->set_javascript_builtin(id, *function); builtins->set_javascript_builtin(id, *function);
Handle<SharedFunctionInfo> shared Handle<SharedFunctionInfo> shared
= Handle<SharedFunctionInfo>(function->shared()); = Handle<SharedFunctionInfo>(function->shared());
......
This diff is collapsed.
...@@ -123,7 +123,7 @@ Handle<Code> CodeStub::GetCode() { ...@@ -123,7 +123,7 @@ Handle<Code> CodeStub::GetCode() {
} }
Object* CodeStub::TryGetCode() { MaybeObject* CodeStub::TryGetCode() {
Code* code; Code* code;
if (!FindCodeInCache(&code)) { if (!FindCodeInCache(&code)) {
// Generate the new code. // Generate the new code.
...@@ -139,8 +139,11 @@ Object* CodeStub::TryGetCode() { ...@@ -139,8 +139,11 @@ Object* CodeStub::TryGetCode() {
static_cast<Code::Kind>(GetCodeKind()), static_cast<Code::Kind>(GetCodeKind()),
InLoop(), InLoop(),
GetICState()); GetICState());
Object* new_object = Heap::CreateCode(desc, flags, masm.CodeObject()); Object* new_object;
if (new_object->IsFailure()) return new_object; { MaybeObject* maybe_new_object =
Heap::CreateCode(desc, flags, masm.CodeObject());
if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object;
}
code = Code::cast(new_object); code = Code::cast(new_object);
RecordCodeGeneration(code, &masm); RecordCodeGeneration(code, &masm);
...@@ -148,8 +151,9 @@ Object* CodeStub::TryGetCode() { ...@@ -148,8 +151,9 @@ Object* CodeStub::TryGetCode() {
SetCustomCache(code); SetCustomCache(code);
} else { } else {
// Try to update the code cache but do not fail if unable. // Try to update the code cache but do not fail if unable.
new_object = Heap::code_stubs()->AtNumberPut(GetKey(), code); MaybeObject* maybe_new_object =
if (!new_object->IsFailure()) { Heap::code_stubs()->AtNumberPut(GetKey(), code);
if (maybe_new_object->ToObject(&new_object)) {
Heap::public_set_code_stubs(NumberDictionary::cast(new_object)); Heap::public_set_code_stubs(NumberDictionary::cast(new_object));
} }
} }
......
...@@ -106,7 +106,7 @@ class CodeStub BASE_EMBEDDED { ...@@ -106,7 +106,7 @@ class CodeStub BASE_EMBEDDED {
// Retrieve the code for the stub if already generated. Do not // Retrieve the code for the stub if already generated. Do not
// generate the code if not already generated and instead return a // generate the code if not already generated and instead return a
// retry after GC Failure object. // retry after GC Failure object.
Object* TryGetCode(); MUST_USE_RESULT MaybeObject* TryGetCode();
static Major MajorKeyFromKey(uint32_t key) { static Major MajorKeyFromKey(uint32_t key) {
return static_cast<Major>(MajorKeyBits::decode(key)); return static_cast<Major>(MajorKeyBits::decode(key));
......
...@@ -110,7 +110,7 @@ class CompilationCacheScript : public CompilationSubCache { ...@@ -110,7 +110,7 @@ class CompilationCacheScript : public CompilationSubCache {
void Put(Handle<String> source, Handle<SharedFunctionInfo> function_info); void Put(Handle<String> source, Handle<SharedFunctionInfo> function_info);
private: private:
MUST_USE_RESULT Object* TryTablePut( MUST_USE_RESULT MaybeObject* TryTablePut(
Handle<String> source, Handle<SharedFunctionInfo> function_info); Handle<String> source, Handle<SharedFunctionInfo> function_info);
// Note: Returns a new hash table if operation results in expansion. // Note: Returns a new hash table if operation results in expansion.
...@@ -140,7 +140,7 @@ class CompilationCacheEval: public CompilationSubCache { ...@@ -140,7 +140,7 @@ class CompilationCacheEval: public CompilationSubCache {
Handle<SharedFunctionInfo> function_info); Handle<SharedFunctionInfo> function_info);
private: private:
MUST_USE_RESULT Object* TryTablePut( MUST_USE_RESULT MaybeObject* TryTablePut(
Handle<String> source, Handle<String> source,
Handle<Context> context, Handle<Context> context,
Handle<SharedFunctionInfo> function_info); Handle<SharedFunctionInfo> function_info);
...@@ -168,9 +168,9 @@ class CompilationCacheRegExp: public CompilationSubCache { ...@@ -168,9 +168,9 @@ class CompilationCacheRegExp: public CompilationSubCache {
JSRegExp::Flags flags, JSRegExp::Flags flags,
Handle<FixedArray> data); Handle<FixedArray> data);
private: private:
MUST_USE_RESULT Object* TryTablePut(Handle<String> source, MUST_USE_RESULT MaybeObject* TryTablePut(Handle<String> source,
JSRegExp::Flags flags, JSRegExp::Flags flags,
Handle<FixedArray> data); Handle<FixedArray> data);
// Note: Returns a new hash table if operation results in expansion. // Note: Returns a new hash table if operation results in expansion.
Handle<CompilationCacheTable> TablePut(Handle<String> source, Handle<CompilationCacheTable> TablePut(Handle<String> source,
...@@ -333,7 +333,7 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(Handle<String> source, ...@@ -333,7 +333,7 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(Handle<String> source,
} }
Object* CompilationCacheScript::TryTablePut( MaybeObject* CompilationCacheScript::TryTablePut(
Handle<String> source, Handle<String> source,
Handle<SharedFunctionInfo> function_info) { Handle<SharedFunctionInfo> function_info) {
Handle<CompilationCacheTable> table = GetFirstTable(); Handle<CompilationCacheTable> table = GetFirstTable();
...@@ -386,7 +386,7 @@ Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( ...@@ -386,7 +386,7 @@ Handle<SharedFunctionInfo> CompilationCacheEval::Lookup(
} }
Object* CompilationCacheEval::TryTablePut( MaybeObject* CompilationCacheEval::TryTablePut(
Handle<String> source, Handle<String> source,
Handle<Context> context, Handle<Context> context,
Handle<SharedFunctionInfo> function_info) { Handle<SharedFunctionInfo> function_info) {
...@@ -442,7 +442,7 @@ Handle<FixedArray> CompilationCacheRegExp::Lookup(Handle<String> source, ...@@ -442,7 +442,7 @@ Handle<FixedArray> CompilationCacheRegExp::Lookup(Handle<String> source,
} }
Object* CompilationCacheRegExp::TryTablePut( MaybeObject* CompilationCacheRegExp::TryTablePut(
Handle<String> source, Handle<String> source,
JSRegExp::Flags flags, JSRegExp::Flags flags,
Handle<FixedArray> data) { Handle<FixedArray> data) {
......
...@@ -1038,7 +1038,7 @@ bool Debug::CheckBreakPoint(Handle<Object> break_point_object) { ...@@ -1038,7 +1038,7 @@ bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
Factory::LookupAsciiSymbol("IsBreakPointTriggered"); Factory::LookupAsciiSymbol("IsBreakPointTriggered");
Handle<JSFunction> check_break_point = Handle<JSFunction> check_break_point =
Handle<JSFunction>(JSFunction::cast( Handle<JSFunction>(JSFunction::cast(
debug_context()->global()->GetProperty( debug_context()->global()->GetPropertyNoExceptionThrown(
*is_break_point_triggered_symbol))); *is_break_point_triggered_symbol)));
// Get the break id as an object. // Get the break id as an object.
...@@ -1847,7 +1847,8 @@ void Debug::ClearMirrorCache() { ...@@ -1847,7 +1847,8 @@ void Debug::ClearMirrorCache() {
// Clear the mirror cache. // Clear the mirror cache.
Handle<String> function_name = Handle<String> function_name =
Factory::LookupSymbol(CStrVector("ClearMirrorCache")); Factory::LookupSymbol(CStrVector("ClearMirrorCache"));
Handle<Object> fun(Top::global()->GetProperty(*function_name)); Handle<Object> fun(Top::global()->GetPropertyNoExceptionThrown(
*function_name));
ASSERT(fun->IsJSFunction()); ASSERT(fun->IsJSFunction());
bool caught_exception; bool caught_exception;
Handle<Object> js_object = Execution::TryCall( Handle<Object> js_object = Execution::TryCall(
...@@ -1954,7 +1955,8 @@ Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name, ...@@ -1954,7 +1955,8 @@ Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
// Create the execution state object. // Create the execution state object.
Handle<String> constructor_str = Factory::LookupSymbol(constructor_name); Handle<String> constructor_str = Factory::LookupSymbol(constructor_name);
Handle<Object> constructor(Top::global()->GetProperty(*constructor_str)); Handle<Object> constructor(Top::global()->GetPropertyNoExceptionThrown(
*constructor_str));
ASSERT(constructor->IsJSFunction()); ASSERT(constructor->IsJSFunction());
if (!constructor->IsJSFunction()) { if (!constructor->IsJSFunction()) {
*caught_exception = true; *caught_exception = true;
...@@ -2181,8 +2183,8 @@ void Debugger::OnAfterCompile(Handle<Script> script, ...@@ -2181,8 +2183,8 @@ void Debugger::OnAfterCompile(Handle<Script> script,
Handle<String> update_script_break_points_symbol = Handle<String> update_script_break_points_symbol =
Factory::LookupAsciiSymbol("UpdateScriptBreakPoints"); Factory::LookupAsciiSymbol("UpdateScriptBreakPoints");
Handle<Object> update_script_break_points = Handle<Object> update_script_break_points =
Handle<Object>(Debug::debug_context()->global()->GetProperty( Handle<Object>(Debug::debug_context()->global()->
*update_script_break_points_symbol)); GetPropertyNoExceptionThrown(*update_script_break_points_symbol));
if (!update_script_break_points->IsJSFunction()) { if (!update_script_break_points->IsJSFunction()) {
return; return;
} }
......
...@@ -50,7 +50,7 @@ static Handle<Object> Invoke(bool construct, ...@@ -50,7 +50,7 @@ static Handle<Object> Invoke(bool construct,
VMState state(JS); VMState state(JS);
// Placeholder for return value. // Placeholder for return value.
Object* value = reinterpret_cast<Object*>(kZapValue); MaybeObject* value = reinterpret_cast<Object*>(kZapValue);
typedef Object* (*JSEntryFunction)( typedef Object* (*JSEntryFunction)(
byte* entry, byte* entry,
...@@ -109,7 +109,7 @@ static Handle<Object> Invoke(bool construct, ...@@ -109,7 +109,7 @@ static Handle<Object> Invoke(bool construct,
Top::clear_pending_message(); Top::clear_pending_message();
} }
return Handle<Object>(value); return Handle<Object>(value->ToObjectUnchecked());
} }
...@@ -172,7 +172,17 @@ Handle<Object> Execution::GetFunctionDelegate(Handle<Object> object) { ...@@ -172,7 +172,17 @@ Handle<Object> Execution::GetFunctionDelegate(Handle<Object> object) {
// and Safari so we allow it too. // and Safari so we allow it too.
if (object->IsJSRegExp()) { if (object->IsJSRegExp()) {
Handle<String> exec = Factory::exec_symbol(); Handle<String> exec = Factory::exec_symbol();
return Handle<Object>(object->GetProperty(*exec)); // TODO(lrn): Bug 617. We should use the default function here, not the
// one on the RegExp object.
Object* exec_function;
{ MaybeObject* maybe_exec_function = object->GetProperty(*exec);
// This can lose an exception, but the alternative is to put a failure
// object in a handle, which is not GC safe.
if (!maybe_exec_function->ToObject(&exec_function)) {
return Factory::undefined_value();
}
}
return Handle<Object>(exec_function);
} }
// Objects created through the API can have an instance-call handler // Objects created through the API can have an instance-call handler
...@@ -517,8 +527,8 @@ Handle<JSFunction> Execution::InstantiateFunction( ...@@ -517,8 +527,8 @@ Handle<JSFunction> Execution::InstantiateFunction(
Handle<FunctionTemplateInfo> data, bool* exc) { Handle<FunctionTemplateInfo> data, bool* exc) {
// Fast case: see if the function has already been instantiated // Fast case: see if the function has already been instantiated
int serial_number = Smi::cast(data->serial_number())->value(); int serial_number = Smi::cast(data->serial_number())->value();
Object* elm = Object* elm = Top::global_context()->function_cache()->
Top::global_context()->function_cache()->GetElement(serial_number); GetElementNoExceptionThrown(serial_number);
if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm)); if (elm->IsJSFunction()) return Handle<JSFunction>(JSFunction::cast(elm));
// The function has not yet been instantiated in this context; do it. // The function has not yet been instantiated in this context; do it.
Object** args[1] = { Handle<Object>::cast(data).location() }; Object** args[1] = { Handle<Object>::cast(data).location() };
...@@ -671,7 +681,7 @@ void Execution::ProcessDebugMesssages(bool debug_command_only) { ...@@ -671,7 +681,7 @@ void Execution::ProcessDebugMesssages(bool debug_command_only) {
#endif #endif
Object* Execution::HandleStackGuardInterrupt() { MaybeObject* Execution::HandleStackGuardInterrupt() {
#ifdef ENABLE_DEBUGGER_SUPPORT #ifdef ENABLE_DEBUGGER_SUPPORT
if (StackGuard::IsDebugBreak() || StackGuard::IsDebugCommand()) { if (StackGuard::IsDebugBreak() || StackGuard::IsDebugCommand()) {
DebugBreakHelper(); DebugBreakHelper();
......
...@@ -132,7 +132,7 @@ class Execution : public AllStatic { ...@@ -132,7 +132,7 @@ class Execution : public AllStatic {
// If the stack guard is triggered, but it is not an actual // If the stack guard is triggered, but it is not an actual
// stack overflow, then handle the interruption accordingly. // stack overflow, then handle the interruption accordingly.
static Object* HandleStackGuardInterrupt(); MUST_USE_RESULT static MaybeObject* HandleStackGuardInterrupt();
// Get a function delegate (or undefined) for the given non-function // Get a function delegate (or undefined) for the given non-function
// object. Used for support calling objects as functions. // object. Used for support calling objects as functions.
......
...@@ -431,7 +431,8 @@ Handle<Object> Factory::NewError(const char* maker, ...@@ -431,7 +431,8 @@ Handle<Object> Factory::NewError(const char* maker,
const char* type, const char* type,
Handle<JSArray> args) { Handle<JSArray> args) {
Handle<String> make_str = Factory::LookupAsciiSymbol(maker); Handle<String> make_str = Factory::LookupAsciiSymbol(maker);
Handle<Object> fun_obj(Top::builtins()->GetProperty(*make_str)); Handle<Object> fun_obj(Top::builtins()->GetPropertyNoExceptionThrown(
*make_str));
// If the builtins haven't been properly configured yet this error // If the builtins haven't been properly configured yet this error
// constructor may not have been defined. Bail out. // constructor may not have been defined. Bail out.
if (!fun_obj->IsJSFunction()) if (!fun_obj->IsJSFunction())
...@@ -464,7 +465,7 @@ Handle<Object> Factory::NewError(const char* constructor, ...@@ -464,7 +465,7 @@ Handle<Object> Factory::NewError(const char* constructor,
Handle<JSFunction> fun = Handle<JSFunction> fun =
Handle<JSFunction>( Handle<JSFunction>(
JSFunction::cast( JSFunction::cast(
Top::builtins()->GetProperty(*constr))); Top::builtins()->GetPropertyNoExceptionThrown(*constr)));
Object** argv[1] = { Handle<Object>::cast(message).location() }; Object** argv[1] = { Handle<Object>::cast(message).location() };
// Invoke the JavaScript factory method. If an exception is thrown while // Invoke the JavaScript factory method. If an exception is thrown while
...@@ -567,12 +568,13 @@ Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { ...@@ -567,12 +568,13 @@ Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) {
} }
static inline Object* DoCopyInsert(DescriptorArray* array, MUST_USE_RESULT static inline MaybeObject* DoCopyInsert(
String* key, DescriptorArray* array,
Object* value, String* key,
PropertyAttributes attributes) { Object* value,
PropertyAttributes attributes) {
CallbacksDescriptor desc(key, value, attributes); CallbacksDescriptor desc(key, value, attributes);
Object* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS); MaybeObject* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS);
return obj; return obj;
} }
...@@ -921,11 +923,15 @@ Handle<MapCache> Factory::NewMapCache(int at_least_space_for) { ...@@ -921,11 +923,15 @@ Handle<MapCache> Factory::NewMapCache(int at_least_space_for) {
} }
static Object* UpdateMapCacheWith(Context* context, MUST_USE_RESULT static MaybeObject* UpdateMapCacheWith(Context* context,
FixedArray* keys, FixedArray* keys,
Map* map) { Map* map) {
Object* result = MapCache::cast(context->map_cache())->Put(keys, map); Object* result;
if (!result->IsFailure()) context->set_map_cache(MapCache::cast(result)); { MaybeObject* maybe_result =
MapCache::cast(context->map_cache())->Put(keys, map);
if (!maybe_result->ToObject(&result)) return maybe_result;
}
context->set_map_cache(MapCache::cast(result));
return result; return result;
} }
......
...@@ -324,6 +324,7 @@ class MarkCompactCollector; ...@@ -324,6 +324,7 @@ class MarkCompactCollector;
class NewSpace; class NewSpace;
class NodeVisitor; class NodeVisitor;
class Object; class Object;
class MaybeObject;
class OldSpace; class OldSpace;
class Property; class Property;
class Proxy; class Proxy;
...@@ -542,8 +543,8 @@ union IeeeDoubleBigEndianArchType { ...@@ -542,8 +543,8 @@ union IeeeDoubleBigEndianArchType {
// AccessorCallback // AccessorCallback
struct AccessorDescriptor { struct AccessorDescriptor {
Object* (*getter)(Object* object, void* data); MaybeObject* (*getter)(Object* object, void* data);
Object* (*setter)(JSObject* object, Object* value, void* data); MaybeObject* (*setter)(JSObject* object, Object* value, void* data);
void* data; void* data;
}; };
......
...@@ -40,23 +40,23 @@ int Heap::MaxObjectSizeInPagedSpace() { ...@@ -40,23 +40,23 @@ int Heap::MaxObjectSizeInPagedSpace() {
} }
Object* Heap::AllocateSymbol(Vector<const char> str, MaybeObject* Heap::AllocateSymbol(Vector<const char> str,
int chars, int chars,
uint32_t hash_field) { uint32_t hash_field) {
unibrow::Utf8InputBuffer<> buffer(str.start(), unibrow::Utf8InputBuffer<> buffer(str.start(),
static_cast<unsigned>(str.length())); static_cast<unsigned>(str.length()));
return AllocateInternalSymbol(&buffer, chars, hash_field); return AllocateInternalSymbol(&buffer, chars, hash_field);
} }
Object* Heap::CopyFixedArray(FixedArray* src) { MaybeObject* Heap::CopyFixedArray(FixedArray* src) {
return CopyFixedArrayWithMap(src, src->map()); return CopyFixedArrayWithMap(src, src->map());
} }
Object* Heap::AllocateRaw(int size_in_bytes, MaybeObject* Heap::AllocateRaw(int size_in_bytes,
AllocationSpace space, AllocationSpace space,
AllocationSpace retry_space) { AllocationSpace retry_space) {
ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC);
ASSERT(space != NEW_SPACE || ASSERT(space != NEW_SPACE ||
retry_space == OLD_POINTER_SPACE || retry_space == OLD_POINTER_SPACE ||
...@@ -71,7 +71,7 @@ Object* Heap::AllocateRaw(int size_in_bytes, ...@@ -71,7 +71,7 @@ Object* Heap::AllocateRaw(int size_in_bytes,
Counters::objs_since_last_full.Increment(); Counters::objs_since_last_full.Increment();
Counters::objs_since_last_young.Increment(); Counters::objs_since_last_young.Increment();
#endif #endif
Object* result; MaybeObject* result;
if (NEW_SPACE == space) { if (NEW_SPACE == space) {
result = new_space_.AllocateRaw(size_in_bytes); result = new_space_.AllocateRaw(size_in_bytes);
if (always_allocate() && result->IsFailure()) { if (always_allocate() && result->IsFailure()) {
...@@ -100,14 +100,14 @@ Object* Heap::AllocateRaw(int size_in_bytes, ...@@ -100,14 +100,14 @@ Object* Heap::AllocateRaw(int size_in_bytes,
} }
Object* Heap::NumberFromInt32(int32_t value) { MaybeObject* Heap::NumberFromInt32(int32_t value) {
if (Smi::IsValid(value)) return Smi::FromInt(value); if (Smi::IsValid(value)) return Smi::FromInt(value);
// Bypass NumberFromDouble to avoid various redundant checks. // Bypass NumberFromDouble to avoid various redundant checks.
return AllocateHeapNumber(FastI2D(value)); return AllocateHeapNumber(FastI2D(value));
} }
Object* Heap::NumberFromUint32(uint32_t value) { MaybeObject* Heap::NumberFromUint32(uint32_t value) {
if ((int32_t)value >= 0 && Smi::IsValid((int32_t)value)) { if ((int32_t)value >= 0 && Smi::IsValid((int32_t)value)) {
return Smi::FromInt((int32_t)value); return Smi::FromInt((int32_t)value);
} }
...@@ -134,12 +134,12 @@ void Heap::FinalizeExternalString(String* string) { ...@@ -134,12 +134,12 @@ void Heap::FinalizeExternalString(String* string) {
} }
Object* Heap::AllocateRawMap() { MaybeObject* Heap::AllocateRawMap() {
#ifdef DEBUG #ifdef DEBUG
Counters::objs_since_last_full.Increment(); Counters::objs_since_last_full.Increment();
Counters::objs_since_last_young.Increment(); Counters::objs_since_last_young.Increment();
#endif #endif
Object* result = map_space_->AllocateRaw(Map::kSize); MaybeObject* result = map_space_->AllocateRaw(Map::kSize);
if (result->IsFailure()) old_gen_exhausted_ = true; if (result->IsFailure()) old_gen_exhausted_ = true;
#ifdef DEBUG #ifdef DEBUG
if (!result->IsFailure()) { if (!result->IsFailure()) {
...@@ -152,12 +152,12 @@ Object* Heap::AllocateRawMap() { ...@@ -152,12 +152,12 @@ Object* Heap::AllocateRawMap() {
} }
Object* Heap::AllocateRawCell() { MaybeObject* Heap::AllocateRawCell() {
#ifdef DEBUG #ifdef DEBUG
Counters::objs_since_last_full.Increment(); Counters::objs_since_last_full.Increment();
Counters::objs_since_last_young.Increment(); Counters::objs_since_last_young.Increment();
#endif #endif
Object* result = cell_space_->AllocateRaw(JSGlobalPropertyCell::kSize); MaybeObject* result = cell_space_->AllocateRaw(JSGlobalPropertyCell::kSize);
if (result->IsFailure()) old_gen_exhausted_ = true; if (result->IsFailure()) old_gen_exhausted_ = true;
return result; return result;
} }
...@@ -330,14 +330,14 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { ...@@ -330,14 +330,14 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
} }
Object* Heap::PrepareForCompare(String* str) { MaybeObject* Heap::PrepareForCompare(String* str) {
// Always flatten small strings and force flattening of long strings // Always flatten small strings and force flattening of long strings
// after we have accumulated a certain amount we failed to flatten. // after we have accumulated a certain amount we failed to flatten.
static const int kMaxAlwaysFlattenLength = 32; static const int kMaxAlwaysFlattenLength = 32;
static const int kFlattenLongThreshold = 16*KB; static const int kFlattenLongThreshold = 16*KB;
const int length = str->length(); const int length = str->length();
Object* obj = str->TryFlatten(); MaybeObject* obj = str->TryFlatten();
if (length <= kMaxAlwaysFlattenLength || if (length <= kMaxAlwaysFlattenLength ||
unflattened_strings_length_ >= kFlattenLongThreshold) { unflattened_strings_length_ >= kFlattenLongThreshold) {
return obj; return obj;
...@@ -391,34 +391,36 @@ void Heap::SetLastScriptId(Object* last_script_id) { ...@@ -391,34 +391,36 @@ void Heap::SetLastScriptId(Object* last_script_id) {
// to guarantee that any allocations performed during the call will // to guarantee that any allocations performed during the call will
// succeed if there's enough memory. // succeed if there's enough memory.
// Warning: Do not use the identifiers __object__ or __scope__ in a // Warning: Do not use the identifiers __object__, __maybe_object__ or
// call to this macro. // __scope__ in a call to this macro.
#define CALL_AND_RETRY(FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY) \ #define CALL_AND_RETRY(FUNCTION_CALL, RETURN_VALUE, RETURN_EMPTY) \
do { \ do { \
GC_GREEDY_CHECK(); \ GC_GREEDY_CHECK(); \
Object* __object__ = FUNCTION_CALL; \ MaybeObject* __maybe_object__ = FUNCTION_CALL; \
if (!__object__->IsFailure()) RETURN_VALUE; \ Object* __object__ = NULL; \
if (__object__->IsOutOfMemoryFailure()) { \ if (__maybe_object__->ToObject(&__object__)) RETURN_VALUE; \
if (__maybe_object__->IsOutOfMemory()) { \
v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_0", true);\ v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_0", true);\
} \ } \
if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ if (!__maybe_object__->IsRetryAfterGC()) RETURN_EMPTY; \
Heap::CollectGarbage(Failure::cast(__object__)->allocation_space()); \ Heap::CollectGarbage(Failure::cast(__maybe_object__)-> \
__object__ = FUNCTION_CALL; \ allocation_space()); \
if (!__object__->IsFailure()) RETURN_VALUE; \ __maybe_object__ = FUNCTION_CALL; \
if (__object__->IsOutOfMemoryFailure()) { \ if (__maybe_object__->ToObject(&__object__)) RETURN_VALUE; \
if (__maybe_object__->IsOutOfMemory()) { \
v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1", true);\ v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_1", true);\
} \ } \
if (!__object__->IsRetryAfterGC()) RETURN_EMPTY; \ if (!__maybe_object__->IsRetryAfterGC()) RETURN_EMPTY; \
Counters::gc_last_resort_from_handles.Increment(); \ Counters::gc_last_resort_from_handles.Increment(); \
Heap::CollectAllGarbage(false); \ Heap::CollectAllGarbage(false); \
{ \ { \
AlwaysAllocateScope __scope__; \ AlwaysAllocateScope __scope__; \
__object__ = FUNCTION_CALL; \ __maybe_object__ = FUNCTION_CALL; \
} \ } \
if (!__object__->IsFailure()) RETURN_VALUE; \ if (__maybe_object__->ToObject(&__object__)) RETURN_VALUE; \
if (__object__->IsOutOfMemoryFailure() || \ if (__maybe_object__->IsOutOfMemory() || \
__object__->IsRetryAfterGC()) { \ __maybe_object__->IsRetryAfterGC()) { \
/* TODO(1181417): Fix this. */ \ /* TODO(1181417): Fix this. */ \
v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2", true);\ v8::internal::V8::FatalProcessOutOfMemory("CALL_AND_RETRY_2", true);\
} \ } \
......
This diff is collapsed.
This diff is collapsed.
...@@ -120,10 +120,15 @@ void CpuFeatures::Probe() { ...@@ -120,10 +120,15 @@ void CpuFeatures::Probe() {
CodeDesc desc; CodeDesc desc;
assm.GetCode(&desc); assm.GetCode(&desc);
Object* code = Heap::CreateCode(desc,
Code::ComputeFlags(Code::STUB), Object* code;
Handle<Code>::null()); { MaybeObject* maybe_code = Heap::CreateCode(desc,
Code::ComputeFlags(Code::STUB),
Handle<Code>::null());
if (!maybe_code->ToObject(&code)) return;
}
if (!code->IsCode()) return; if (!code->IsCode()) return;
PROFILE(CodeCreateEvent(Logger::BUILTIN_TAG, PROFILE(CodeCreateEvent(Logger::BUILTIN_TAG,
Code::cast(code), "CpuFeatures::Probe")); Code::cast(code), "CpuFeatures::Probe"));
typedef uint64_t (*F0)(); typedef uint64_t (*F0)();
......
...@@ -976,12 +976,13 @@ void MacroAssembler::CallStub(CodeStub* stub) { ...@@ -976,12 +976,13 @@ void MacroAssembler::CallStub(CodeStub* stub) {
} }
Object* MacroAssembler::TryCallStub(CodeStub* stub) { MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub) {
ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs. ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs.
Object* result = stub->TryGetCode(); Object* result;
if (!result->IsFailure()) { { MaybeObject* maybe_result = stub->TryGetCode();
call(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET); if (!maybe_result->ToObject(&result)) return maybe_result;
} }
call(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET);
return result; return result;
} }
...@@ -992,12 +993,13 @@ void MacroAssembler::TailCallStub(CodeStub* stub) { ...@@ -992,12 +993,13 @@ void MacroAssembler::TailCallStub(CodeStub* stub) {
} }
Object* MacroAssembler::TryTailCallStub(CodeStub* stub) { MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub) {
ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs. ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs.
Object* result = stub->TryGetCode(); Object* result;
if (!result->IsFailure()) { { MaybeObject* maybe_result = stub->TryGetCode();
jmp(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET); if (!maybe_result->ToObject(&result)) return maybe_result;
} }
jmp(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET);
return result; return result;
} }
...@@ -1040,8 +1042,8 @@ void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { ...@@ -1040,8 +1042,8 @@ void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) {
} }
Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id, MaybeObject* MacroAssembler::TryCallRuntime(Runtime::FunctionId id,
int num_arguments) { int num_arguments) {
return TryCallRuntime(Runtime::FunctionForId(id), num_arguments); return TryCallRuntime(Runtime::FunctionForId(id), num_arguments);
} }
...@@ -1066,8 +1068,8 @@ void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) { ...@@ -1066,8 +1068,8 @@ void MacroAssembler::CallRuntime(Runtime::Function* f, int num_arguments) {
} }
Object* MacroAssembler::TryCallRuntime(Runtime::Function* f, MaybeObject* MacroAssembler::TryCallRuntime(Runtime::Function* f,
int num_arguments) { int num_arguments) {
if (f->nargs >= 0 && f->nargs != num_arguments) { if (f->nargs >= 0 && f->nargs != num_arguments) {
IllegalOperation(num_arguments); IllegalOperation(num_arguments);
// Since we did not call the stub, there was no allocation failure. // Since we did not call the stub, there was no allocation failure.
......
...@@ -421,7 +421,7 @@ class MacroAssembler: public Assembler { ...@@ -421,7 +421,7 @@ class MacroAssembler: public Assembler {
// Call a code stub and return the code object called. Try to generate // Call a code stub and return the code object called. Try to generate
// the code if necessary. Do not perform a GC but instead return a retry // the code if necessary. Do not perform a GC but instead return a retry
// after GC failure. // after GC failure.
Object* TryCallStub(CodeStub* stub); MUST_USE_RESULT MaybeObject* TryCallStub(CodeStub* stub);
// Tail call a code stub (jump). Generate the code if necessary. // Tail call a code stub (jump). Generate the code if necessary.
void TailCallStub(CodeStub* stub); void TailCallStub(CodeStub* stub);
...@@ -429,7 +429,7 @@ class MacroAssembler: public Assembler { ...@@ -429,7 +429,7 @@ class MacroAssembler: public Assembler {
// Tail call a code stub (jump) and return the code object called. Try to // Tail call a code stub (jump) and return the code object called. Try to
// generate the code if necessary. Do not perform a GC but instead return // generate the code if necessary. Do not perform a GC but instead return
// a retry after GC failure. // a retry after GC failure.
Object* TryTailCallStub(CodeStub* stub); MUST_USE_RESULT MaybeObject* TryTailCallStub(CodeStub* stub);
// Return from a code stub after popping its arguments. // Return from a code stub after popping its arguments.
void StubReturn(int argc); void StubReturn(int argc);
...@@ -440,13 +440,15 @@ class MacroAssembler: public Assembler { ...@@ -440,13 +440,15 @@ class MacroAssembler: public Assembler {
// Call a runtime function, returning the CodeStub object called. // Call a runtime function, returning the CodeStub object called.
// Try to generate the stub code if necessary. Do not perform a GC // Try to generate the stub code if necessary. Do not perform a GC
// but instead return a retry after GC failure. // but instead return a retry after GC failure.
Object* TryCallRuntime(Runtime::Function* f, int num_arguments); MUST_USE_RESULT MaybeObject* TryCallRuntime(Runtime::Function* f,
int num_arguments);
// Convenience function: Same as above, but takes the fid instead. // Convenience function: Same as above, but takes the fid instead.
void CallRuntime(Runtime::FunctionId id, int num_arguments); void CallRuntime(Runtime::FunctionId id, int num_arguments);
// Convenience function: Same as above, but takes the fid instead. // Convenience function: Same as above, but takes the fid instead.
Object* TryCallRuntime(Runtime::FunctionId id, int num_arguments); MUST_USE_RESULT MaybeObject* TryCallRuntime(Runtime::FunctionId id,
int num_arguments);
// Convenience function: call an external reference. // Convenience function: call an external reference.
void CallExternalReference(ExternalReference ref, int num_arguments); void CallExternalReference(ExternalReference ref, int num_arguments);
...@@ -597,9 +599,9 @@ class MacroAssembler: public Assembler { ...@@ -597,9 +599,9 @@ class MacroAssembler: public Assembler {
// Helper for PopHandleScope. Allowed to perform a GC and returns // Helper for PopHandleScope. Allowed to perform a GC and returns
// NULL if gc_allowed. Does not perform a GC if !gc_allowed, and // NULL if gc_allowed. Does not perform a GC if !gc_allowed, and
// possibly returns a failure object indicating an allocation failure. // possibly returns a failure object indicating an allocation failure.
Object* PopHandleScopeHelper(Register saved, MUST_USE_RESULT MaybeObject* PopHandleScopeHelper(Register saved,
Register scratch, Register scratch,
bool gc_allowed); bool gc_allowed);
}; };
......
...@@ -1067,7 +1067,7 @@ int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address, ...@@ -1067,7 +1067,7 @@ int RegExpMacroAssemblerIA32::CheckStackGuardState(Address* return_address,
ASSERT(*return_address <= ASSERT(*return_address <=
re_code->instruction_start() + re_code->instruction_size()); re_code->instruction_start() + re_code->instruction_size());
Object* result = Execution::HandleStackGuardInterrupt(); MaybeObject* result = Execution::HandleStackGuardInterrupt();
if (*code_handle != re_code) { // Return address no longer valid if (*code_handle != re_code) { // Return address no longer valid
int delta = *code_handle - re_code; int delta = *code_handle - re_code;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -83,14 +83,15 @@ class LiveEdit : AllStatic { ...@@ -83,14 +83,15 @@ class LiveEdit : AllStatic {
static void WrapSharedFunctionInfos(Handle<JSArray> array); static void WrapSharedFunctionInfos(Handle<JSArray> array);
static Object* ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, MUST_USE_RESULT static MaybeObject* ReplaceFunctionCode(
Handle<JSArray> shared_info_array); Handle<JSArray> new_compile_info_array,
Handle<JSArray> shared_info_array);
// Updates script field in FunctionSharedInfo. // Updates script field in FunctionSharedInfo.
static void SetFunctionScript(Handle<JSValue> function_wrapper, static void SetFunctionScript(Handle<JSValue> function_wrapper,
Handle<Object> script_handle); Handle<Object> script_handle);
static Object* PatchFunctionPositions( MUST_USE_RESULT static MaybeObject* PatchFunctionPositions(
Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array); Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array);
// For a script updates its source field. If old_script_name is provided // For a script updates its source field. If old_script_name is provided
......
...@@ -559,7 +559,12 @@ void Logger::LogRuntime(Vector<const char> format, JSArray* args) { ...@@ -559,7 +559,12 @@ void Logger::LogRuntime(Vector<const char> format, JSArray* args) {
if (c == '%' && i <= format.length() - 2) { if (c == '%' && i <= format.length() - 2) {
i++; i++;
ASSERT('0' <= format[i] && format[i] <= '9'); ASSERT('0' <= format[i] && format[i] <= '9');
Object* obj = args->GetElement(format[i] - '0'); MaybeObject* maybe = args->GetElement(format[i] - '0');
Object* obj;
if (!maybe->ToObject(&obj)) {
msg.Append("<exception>");
continue;
}
i++; i++;
switch (format[i]) { switch (format[i]) {
case 's': case 's':
......
This diff is collapsed.
...@@ -53,7 +53,8 @@ class MarkCompactCollector: public AllStatic { ...@@ -53,7 +53,8 @@ class MarkCompactCollector: public AllStatic {
// Object* that will be the object after forwarding. There is a separate // Object* that will be the object after forwarding. There is a separate
// allocation function for each (compactable) space based on the location // allocation function for each (compactable) space based on the location
// of the object before compaction. // of the object before compaction.
typedef Object* (*AllocationFunction)(HeapObject* object, int object_size); typedef MaybeObject* (*AllocationFunction)(HeapObject* object,
int object_size);
// Type of functions to encode the forwarding address for an object. // Type of functions to encode the forwarding address for an object.
// Given the object, its size, and the new (non-failure) object it will be // Given the object, its size, and the new (non-failure) object it will be
......
...@@ -152,8 +152,8 @@ void MessageHandler::ReportMessage(MessageLocation* loc, ...@@ -152,8 +152,8 @@ void MessageHandler::ReportMessage(MessageLocation* loc,
Handle<String> MessageHandler::GetMessage(Handle<Object> data) { Handle<String> MessageHandler::GetMessage(Handle<Object> data) {
Handle<String> fmt_str = Factory::LookupAsciiSymbol("FormatMessage"); Handle<String> fmt_str = Factory::LookupAsciiSymbol("FormatMessage");
Handle<JSFunction> fun = Handle<JSFunction> fun =
Handle<JSFunction>( Handle<JSFunction>(JSFunction::cast(
JSFunction::cast(Top::builtins()->GetProperty(*fmt_str))); Top::builtins()->GetPropertyNoExceptionThrown(*fmt_str)));
Object** argv[1] = { data.location() }; Object** argv[1] = { data.location() };
bool caught_exception; bool caught_exception;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -4266,11 +4266,9 @@ Expression* Parser::NewThrowError(Handle<String> constructor, ...@@ -4266,11 +4266,9 @@ Expression* Parser::NewThrowError(Handle<String> constructor,
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
Handle<Object> element = arguments[i]; Handle<Object> element = arguments[i];
if (!element.is_null()) { if (!element.is_null()) {
Object* ok = array->SetFastElement(i, *element);
USE(ok); // Don't get an unused variable warning.
// We know this doesn't cause a GC here because we allocated the JSArray // We know this doesn't cause a GC here because we allocated the JSArray
// large enough. // large enough.
ASSERT(!ok->IsFailure()); array->SetFastElement(i, *element)->ToObjectUnchecked();
} }
} }
ZoneList<Expression*>* args = new ZoneList<Expression*>(2); ZoneList<Expression*>* args = new ZoneList<Expression*>(2);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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