Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Side by Side Diff: src/bootstrapper.cc

Issue 3970005: Make Failure inherit from MaybeObject instead of Object. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/builtins.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 ? top_context->builtins() 1002 ? top_context->builtins()
1003 : top_context->global()); 1003 : top_context->global());
1004 bool has_pending_exception; 1004 bool has_pending_exception;
1005 Handle<Object> result = 1005 Handle<Object> result =
1006 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); 1006 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
1007 if (has_pending_exception) return false; 1007 if (has_pending_exception) return false;
1008 return true; 1008 return true;
1009 } 1009 }
1010 1010
1011 1011
1012 #define INSTALL_NATIVE(Type, name, var) \ 1012 #define INSTALL_NATIVE(Type, name, var) \
1013 Handle<String> var##_name = Factory::LookupAsciiSymbol(name); \ 1013 Handle<String> var##_name = Factory::LookupAsciiSymbol(name); \
1014 global_context()->set_##var(Type::cast(global_context()-> \ 1014 global_context()->set_##var(Type::cast( \
1015 builtins()-> \ 1015 global_context()->builtins()->GetPropertyNoExceptionThrown(*var##_name)));
1016 GetProperty(*var##_name)));
1017 1016
1018 void Genesis::InstallNativeFunctions() { 1017 void Genesis::InstallNativeFunctions() {
1019 HandleScope scope; 1018 HandleScope scope;
1020 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); 1019 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
1021 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); 1020 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
1022 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun); 1021 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
1023 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun); 1022 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
1024 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun); 1023 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun);
1025 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun); 1024 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
1026 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun); 1025 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 Handle<JSFunction> function = Handle<JSFunction>::cast( 1361 Handle<JSFunction> function = Handle<JSFunction>::cast(
1363 GetProperty(global, Factory::LookupSymbol(property))); 1362 GetProperty(global, Factory::LookupSymbol(property)));
1364 return Handle<JSObject>(JSObject::cast(function->prototype())); 1363 return Handle<JSObject>(JSObject::cast(function->prototype()));
1365 } 1364 }
1366 1365
1367 1366
1368 static void InstallCustomCallGenerator(Handle<JSObject> holder, 1367 static void InstallCustomCallGenerator(Handle<JSObject> holder,
1369 const char* function_name, 1368 const char* function_name,
1370 int id) { 1369 int id) {
1371 Handle<String> name = Factory::LookupAsciiSymbol(function_name); 1370 Handle<String> name = Factory::LookupAsciiSymbol(function_name);
1372 Handle<JSFunction> function(JSFunction::cast(holder->GetProperty(*name))); 1371 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
1372 Handle<JSFunction> function(JSFunction::cast(function_object));
1373 function->shared()->set_function_data(Smi::FromInt(id)); 1373 function->shared()->set_function_data(Smi::FromInt(id));
1374 } 1374 }
1375 1375
1376 1376
1377 void Genesis::InstallCustomCallGenerators() { 1377 void Genesis::InstallCustomCallGenerators() {
1378 HandleScope scope; 1378 HandleScope scope;
1379 #define INSTALL_CALL_GENERATOR(holder_expr, fun_name, name) \ 1379 #define INSTALL_CALL_GENERATOR(holder_expr, fun_name, name) \
1380 { \ 1380 { \
1381 Handle<JSObject> holder = ResolveCustomCallGeneratorHolder( \ 1381 Handle<JSObject> holder = ResolveCustomCallGeneratorHolder( \
1382 global_context(), #holder_expr); \ 1382 global_context(), #holder_expr); \
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 current->set_state(v8::INSTALLED); 1577 current->set_state(v8::INSTALLED);
1578 return result; 1578 return result;
1579 } 1579 }
1580 1580
1581 1581
1582 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) { 1582 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
1583 HandleScope scope; 1583 HandleScope scope;
1584 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { 1584 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
1585 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); 1585 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
1586 Handle<String> name = Factory::LookupAsciiSymbol(Builtins::GetName(id)); 1586 Handle<String> name = Factory::LookupAsciiSymbol(Builtins::GetName(id));
1587 Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
1587 Handle<JSFunction> function 1588 Handle<JSFunction> function
1588 = Handle<JSFunction>(JSFunction::cast(builtins->GetProperty(*name))); 1589 = Handle<JSFunction>(JSFunction::cast(function_object));
1589 builtins->set_javascript_builtin(id, *function); 1590 builtins->set_javascript_builtin(id, *function);
1590 Handle<SharedFunctionInfo> shared 1591 Handle<SharedFunctionInfo> shared
1591 = Handle<SharedFunctionInfo>(function->shared()); 1592 = Handle<SharedFunctionInfo>(function->shared());
1592 if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false; 1593 if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false;
1593 // Set the code object on the function object. 1594 // Set the code object on the function object.
1594 function->set_code(function->shared()->code()); 1595 function->set_code(function->shared()->code());
1595 builtins->set_javascript_builtin_code(id, shared->code()); 1596 builtins->set_javascript_builtin_code(id, shared->code());
1596 } 1597 }
1597 return true; 1598 return true;
1598 } 1599 }
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 } 1864 }
1864 1865
1865 1866
1866 // Restore statics that are thread local. 1867 // Restore statics that are thread local.
1867 char* BootstrapperActive::RestoreState(char* from) { 1868 char* BootstrapperActive::RestoreState(char* from) {
1868 nesting_ = *reinterpret_cast<int*>(from); 1869 nesting_ = *reinterpret_cast<int*>(from);
1869 return from + sizeof(nesting_); 1870 return from + sizeof(nesting_);
1870 } 1871 }
1871 1872
1872 } } // namespace v8::internal 1873 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698