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

Side by Side Diff: src/bootstrapper.cc

Issue 327173002: Optimize various forms of slice.call(arguments, ...) (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | src/contexts.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/natives.h" 9 #include "src/natives.h"
10 #include "src/snapshot.h" 10 #include "src/snapshot.h"
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 Handle<String> property_string = factory->InternalizeUtf8String(property); 2051 Handle<String> property_string = factory->InternalizeUtf8String(property);
2052 ASSERT(!property_string.is_null()); 2052 ASSERT(!property_string.is_null());
2053 Handle<JSFunction> function = Handle<JSFunction>::cast( 2053 Handle<JSFunction> function = Handle<JSFunction>::cast(
2054 Object::GetProperty(global, property_string).ToHandleChecked()); 2054 Object::GetProperty(global, property_string).ToHandleChecked());
2055 return Handle<JSObject>(JSObject::cast(function->prototype())); 2055 return Handle<JSObject>(JSObject::cast(function->prototype()));
2056 } 2056 }
2057 2057
2058 2058
2059 static void InstallBuiltinFunctionId(Handle<JSObject> holder, 2059 static void InstallBuiltinFunctionId(Handle<JSObject> holder,
2060 const char* function_name, 2060 const char* function_name,
2061 BuiltinFunctionId id) { 2061 BuiltinFunctionId id,
2062 Handle<FixedArray> builtins) {
2062 Isolate* isolate = holder->GetIsolate(); 2063 Isolate* isolate = holder->GetIsolate();
2063 Handle<Object> function_object = 2064 Handle<Object> function_object =
2064 Object::GetProperty(isolate, holder, function_name).ToHandleChecked(); 2065 Object::GetProperty(isolate, holder, function_name).ToHandleChecked();
2065 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); 2066 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
2066 function->shared()->set_function_data(Smi::FromInt(id)); 2067 function->shared()->set_function_data(Smi::FromInt(id));
2068 builtins->set(static_cast<int>(id), *function);
2067 } 2069 }
2068 2070
2069 2071
2070 void Genesis::InstallBuiltinFunctionIds() { 2072 void Genesis::InstallBuiltinFunctionIds() {
2071 HandleScope scope(isolate()); 2073 HandleScope scope(isolate());
2072 #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \ 2074 Handle<FixedArray> builtins = factory()->NewFixedArray(kBuiltinsLength,
2073 { \ 2075 TENURED);
2074 Handle<JSObject> holder = ResolveBuiltinIdHolder( \ 2076 #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \
2075 native_context(), #holder_expr); \ 2077 { \
2076 BuiltinFunctionId id = k##name; \ 2078 Handle<JSObject> holder = ResolveBuiltinIdHolder( \
2077 InstallBuiltinFunctionId(holder, #fun_name, id); \ 2079 native_context(), #holder_expr); \
2080 BuiltinFunctionId id = k##name; \
2081 InstallBuiltinFunctionId(holder, #fun_name, id, builtins); \
2078 } 2082 }
2079 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID) 2083 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)
2080 #undef INSTALL_BUILTIN_ID 2084 #undef INSTALL_BUILTIN_ID
2085 native_context()->set_builtin_js_functions(*builtins);
2081 } 2086 }
2082 2087
2083 2088
2084 void Genesis::InstallExperimentalBuiltinFunctionIds() { 2089 void Genesis::InstallExperimentalBuiltinFunctionIds() {
2085 HandleScope scope(isolate()); 2090 HandleScope scope(isolate());
2091 Handle<FixedArray> builtins(native_context()->builtin_js_functions());
2086 if (FLAG_harmony_maths) { 2092 if (FLAG_harmony_maths) {
2087 Handle<JSObject> holder = ResolveBuiltinIdHolder(native_context(), "Math"); 2093 Handle<JSObject> holder = ResolveBuiltinIdHolder(native_context(), "Math");
2088 InstallBuiltinFunctionId(holder, "clz32", kMathClz32); 2094 InstallBuiltinFunctionId(holder, "clz32", kMathClz32, builtins);
2089 } 2095 }
2090 } 2096 }
2091 2097
2092 2098
2093 // Do not forget to update macros.py with named constant 2099 // Do not forget to update macros.py with named constant
2094 // of cache id. 2100 // of cache id.
2095 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ 2101 #define JSFUNCTION_RESULT_CACHE_LIST(F) \
2096 F(16, native_context()->regexp_function()) 2102 F(16, native_context()->regexp_function())
2097 2103
2098 2104
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 return from + sizeof(NestingCounterType); 2719 return from + sizeof(NestingCounterType);
2714 } 2720 }
2715 2721
2716 2722
2717 // Called when the top-level V8 mutex is destroyed. 2723 // Called when the top-level V8 mutex is destroyed.
2718 void Bootstrapper::FreeThreadResources() { 2724 void Bootstrapper::FreeThreadResources() {
2719 ASSERT(!IsActive()); 2725 ASSERT(!IsActive());
2720 } 2726 }
2721 2727
2722 } } // namespace v8::internal 2728 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698