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

Side by Side Diff: src/bootstrapper.cc

Issue 172133003: Harmony: optimize Math.clz32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 years, 10 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/lithium-codegen-arm.cc ('k') | src/hydrogen.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // templates passed through the API. The inner global from the snapshot is 224 // templates passed through the API. The inner global from the snapshot is
225 // detached from the other objects in the snapshot. 225 // detached from the other objects in the snapshot.
226 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); 226 void HookUpInnerGlobal(Handle<GlobalObject> inner_global);
227 // New context initialization. Used for creating a context from scratch. 227 // New context initialization. Used for creating a context from scratch.
228 void InitializeGlobal(Handle<GlobalObject> inner_global, 228 void InitializeGlobal(Handle<GlobalObject> inner_global,
229 Handle<JSFunction> empty_function); 229 Handle<JSFunction> empty_function);
230 void InitializeExperimentalGlobal(); 230 void InitializeExperimentalGlobal();
231 // Installs the contents of the native .js files on the global objects. 231 // Installs the contents of the native .js files on the global objects.
232 // Used for creating a context from scratch. 232 // Used for creating a context from scratch.
233 void InstallNativeFunctions(); 233 void InstallNativeFunctions();
234 void InstallExperimentalBuiltinFunctionIds();
234 void InstallExperimentalNativeFunctions(); 235 void InstallExperimentalNativeFunctions();
235 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins, 236 Handle<JSFunction> InstallInternalArray(Handle<JSBuiltinsObject> builtins,
236 const char* name, 237 const char* name,
237 ElementsKind elements_kind); 238 ElementsKind elements_kind);
238 bool InstallNatives(); 239 bool InstallNatives();
239 240
240 Handle<JSFunction> InstallTypedArray(const char* name, 241 Handle<JSFunction> InstallTypedArray(const char* name,
241 ElementsKind elementsKind); 242 ElementsKind elementsKind);
242 bool InstallExperimentalNatives(); 243 bool InstallExperimentalNatives();
243 void InstallBuiltinFunctionIds(); 244 void InstallBuiltinFunctionIds();
(...skipping 1809 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 INSTALL_EXPERIMENTAL_NATIVE(i, observation, "object-observe.js") 2054 INSTALL_EXPERIMENTAL_NATIVE(i, observation, "object-observe.js")
2054 INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js") 2055 INSTALL_EXPERIMENTAL_NATIVE(i, promises, "promise.js")
2055 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js") 2056 INSTALL_EXPERIMENTAL_NATIVE(i, generators, "generator.js")
2056 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js") 2057 INSTALL_EXPERIMENTAL_NATIVE(i, iteration, "array-iterator.js")
2057 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js") 2058 INSTALL_EXPERIMENTAL_NATIVE(i, strings, "harmony-string.js")
2058 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js") 2059 INSTALL_EXPERIMENTAL_NATIVE(i, arrays, "harmony-array.js")
2059 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js") 2060 INSTALL_EXPERIMENTAL_NATIVE(i, maths, "harmony-math.js")
2060 } 2061 }
2061 2062
2062 InstallExperimentalNativeFunctions(); 2063 InstallExperimentalNativeFunctions();
2063 2064 InstallExperimentalBuiltinFunctionIds();
2064 return true; 2065 return true;
2065 } 2066 }
2066 2067
2067 2068
2068 static Handle<JSObject> ResolveBuiltinIdHolder( 2069 static Handle<JSObject> ResolveBuiltinIdHolder(
2069 Handle<Context> native_context, 2070 Handle<Context> native_context,
2070 const char* holder_expr) { 2071 const char* holder_expr) {
2071 Isolate* isolate = native_context->GetIsolate(); 2072 Isolate* isolate = native_context->GetIsolate();
2072 Factory* factory = isolate->factory(); 2073 Factory* factory = isolate->factory();
2073 Handle<GlobalObject> global(native_context->global_object()); 2074 Handle<GlobalObject> global(native_context->global_object());
(...skipping 29 matching lines...) Expand all
2103 Handle<JSObject> holder = ResolveBuiltinIdHolder( \ 2104 Handle<JSObject> holder = ResolveBuiltinIdHolder( \
2104 native_context(), #holder_expr); \ 2105 native_context(), #holder_expr); \
2105 BuiltinFunctionId id = k##name; \ 2106 BuiltinFunctionId id = k##name; \
2106 InstallBuiltinFunctionId(holder, #fun_name, id); \ 2107 InstallBuiltinFunctionId(holder, #fun_name, id); \
2107 } 2108 }
2108 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID) 2109 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)
2109 #undef INSTALL_BUILTIN_ID 2110 #undef INSTALL_BUILTIN_ID
2110 } 2111 }
2111 2112
2112 2113
2114 void Genesis::InstallExperimentalBuiltinFunctionIds() {
2115 HandleScope scope(isolate());
2116 if (FLAG_harmony_maths) {
2117 Handle<JSObject> holder = ResolveBuiltinIdHolder(native_context(), "Math");
2118 InstallBuiltinFunctionId(holder, "clz32", kMathClz32);
2119 }
2120 }
2121
2122
2113 // Do not forget to update macros.py with named constant 2123 // Do not forget to update macros.py with named constant
2114 // of cache id. 2124 // of cache id.
2115 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ 2125 #define JSFUNCTION_RESULT_CACHE_LIST(F) \
2116 F(16, native_context()->regexp_function()) 2126 F(16, native_context()->regexp_function())
2117 2127
2118 2128
2119 static FixedArray* CreateCache(int size, Handle<JSFunction> factory_function) { 2129 static FixedArray* CreateCache(int size, Handle<JSFunction> factory_function) {
2120 Factory* factory = factory_function->GetIsolate()->factory(); 2130 Factory* factory = factory_function->GetIsolate()->factory();
2121 // Caches are supposed to live for a long time, allocate in old space. 2131 // Caches are supposed to live for a long time, allocate in old space.
2122 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; 2132 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size;
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 return from + sizeof(NestingCounterType); 2746 return from + sizeof(NestingCounterType);
2737 } 2747 }
2738 2748
2739 2749
2740 // Called when the top-level V8 mutex is destroyed. 2750 // Called when the top-level V8 mutex is destroyed.
2741 void Bootstrapper::FreeThreadResources() { 2751 void Bootstrapper::FreeThreadResources() {
2742 ASSERT(!IsActive()); 2752 ASSERT(!IsActive());
2743 } 2753 }
2744 2754
2745 } } // namespace v8::internal 2755 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698