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

Side by Side Diff: src/bootstrapper.cc

Issue 1730853005: [interpreter] Make setting of function data more resilient. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_interpreter-test-enable-strong
Patch Set: Addressed comments. Created 4 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
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/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 strict_function_map_writable_prototype_->SetConstructor(*function_fun); 1173 strict_function_map_writable_prototype_->SetConstructor(*function_fun);
1174 native_context()->strong_function_map()->SetConstructor(*function_fun); 1174 native_context()->strong_function_map()->SetConstructor(*function_fun);
1175 } 1175 }
1176 1176
1177 { // --- A r r a y --- 1177 { // --- A r r a y ---
1178 Handle<JSFunction> array_function = 1178 Handle<JSFunction> array_function =
1179 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize, 1179 InstallFunction(global, "Array", JS_ARRAY_TYPE, JSArray::kSize,
1180 isolate->initial_object_prototype(), 1180 isolate->initial_object_prototype(),
1181 Builtins::kArrayCode); 1181 Builtins::kArrayCode);
1182 array_function->shared()->DontAdaptArguments(); 1182 array_function->shared()->DontAdaptArguments();
1183 array_function->shared()->set_function_data(Smi::FromInt(kArrayCode)); 1183 array_function->shared()->set_builtin_function_id(kArrayCode);
1184 1184
1185 // This seems a bit hackish, but we need to make sure Array.length 1185 // This seems a bit hackish, but we need to make sure Array.length
1186 // is 1. 1186 // is 1.
1187 array_function->shared()->set_length(1); 1187 array_function->shared()->set_length(1);
1188 1188
1189 Handle<Map> initial_map(array_function->initial_map()); 1189 Handle<Map> initial_map(array_function->initial_map());
1190 1190
1191 // This assert protects an optimization in 1191 // This assert protects an optimization in
1192 // HGraphBuilder::JSArrayBuilder::EmitMapCode() 1192 // HGraphBuilder::JSArrayBuilder::EmitMapCode()
1193 DCHECK(initial_map->elements_kind() == GetInitialFastElementsKind()); 1193 DCHECK(initial_map->elements_kind() == GetInitialFastElementsKind());
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 } 3075 }
3076 3076
3077 3077
3078 static void InstallBuiltinFunctionId(Handle<JSObject> holder, 3078 static void InstallBuiltinFunctionId(Handle<JSObject> holder,
3079 const char* function_name, 3079 const char* function_name,
3080 BuiltinFunctionId id) { 3080 BuiltinFunctionId id) {
3081 Isolate* isolate = holder->GetIsolate(); 3081 Isolate* isolate = holder->GetIsolate();
3082 Handle<Object> function_object = 3082 Handle<Object> function_object =
3083 Object::GetProperty(isolate, holder, function_name).ToHandleChecked(); 3083 Object::GetProperty(isolate, holder, function_name).ToHandleChecked();
3084 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); 3084 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
3085 function->shared()->set_function_data(Smi::FromInt(id)); 3085 function->shared()->set_builtin_function_id(id);
3086 } 3086 }
3087 3087
3088 3088
3089 #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \ 3089 #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \
3090 { #holder_expr, #fun_name, k##name } \ 3090 { #holder_expr, #fun_name, k##name } \
3091 , 3091 ,
3092 3092
3093 3093
3094 void Genesis::InstallBuiltinFunctionIds() { 3094 void Genesis::InstallBuiltinFunctionIds() {
3095 HandleScope scope(isolate()); 3095 HandleScope scope(isolate());
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
3678 } 3678 }
3679 3679
3680 3680
3681 // Called when the top-level V8 mutex is destroyed. 3681 // Called when the top-level V8 mutex is destroyed.
3682 void Bootstrapper::FreeThreadResources() { 3682 void Bootstrapper::FreeThreadResources() {
3683 DCHECK(!IsActive()); 3683 DCHECK(!IsActive());
3684 } 3684 }
3685 3685
3686 } // namespace internal 3686 } // namespace internal
3687 } // namespace v8 3687 } // namespace v8
OLDNEW
« no previous file with comments | « src/api-natives.cc ('k') | src/compiler.cc » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698