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

Side by Side Diff: src/bootstrapper.cc

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: 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/bootstrapper.h ('k') | src/builtins.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 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 23 matching lines...) Expand all
34 #include "debug.h" 34 #include "debug.h"
35 #include "execution.h" 35 #include "execution.h"
36 #include "global-handles.h" 36 #include "global-handles.h"
37 #include "isolate-inl.h" 37 #include "isolate-inl.h"
38 #include "macro-assembler.h" 38 #include "macro-assembler.h"
39 #include "natives.h" 39 #include "natives.h"
40 #include "objects-visiting.h" 40 #include "objects-visiting.h"
41 #include "platform.h" 41 #include "platform.h"
42 #include "snapshot.h" 42 #include "snapshot.h"
43 #include "trig-table.h" 43 #include "trig-table.h"
44 #include "extensions/externalize-string-extension.h"
44 #include "extensions/free-buffer-extension.h" 45 #include "extensions/free-buffer-extension.h"
45 #include "extensions/externalize-string-extension.h"
46 #include "extensions/gc-extension.h" 46 #include "extensions/gc-extension.h"
47 #include "extensions/statistics-extension.h" 47 #include "extensions/statistics-extension.h"
48 #include "extensions/trigger-failure-extension.h"
48 #include "code-stubs.h" 49 #include "code-stubs.h"
49 50
50 namespace v8 { 51 namespace v8 {
51 namespace internal { 52 namespace internal {
52 53
53 54
54 NativesExternalStringResource::NativesExternalStringResource( 55 NativesExternalStringResource::NativesExternalStringResource(
55 Bootstrapper* bootstrapper, 56 Bootstrapper* bootstrapper,
56 const char* source, 57 const char* source,
57 size_t length) 58 size_t length)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 101 }
101 102
102 103
103 void Bootstrapper::InitializeOncePerProcess() { 104 void Bootstrapper::InitializeOncePerProcess() {
104 #ifdef ADDRESS_SANITIZER 105 #ifdef ADDRESS_SANITIZER
105 FreeBufferExtension::Register(); 106 FreeBufferExtension::Register();
106 #endif 107 #endif
107 GCExtension::Register(); 108 GCExtension::Register();
108 ExternalizeStringExtension::Register(); 109 ExternalizeStringExtension::Register();
109 StatisticsExtension::Register(); 110 StatisticsExtension::Register();
111 TriggerFailureExtension::Register();
110 } 112 }
111 113
112 114
113 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) { 115 char* Bootstrapper::AllocateAutoDeletedArray(int bytes) {
114 char* memory = new char[bytes]; 116 char* memory = new char[bytes];
115 if (memory != NULL) { 117 if (memory != NULL) {
116 if (delete_these_arrays_on_tear_down_ == NULL) { 118 if (delete_these_arrays_on_tear_down_ == NULL) {
117 delete_these_arrays_on_tear_down_ = new List<char*>(2); 119 delete_these_arrays_on_tear_down_ = new List<char*>(2);
118 } 120 }
119 delete_these_arrays_on_tear_down_->Add(memory); 121 delete_these_arrays_on_tear_down_->Add(memory);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 new_to_map->set_prototype(*proto); 334 new_to_map->set_prototype(*proto);
333 object->set_map(*new_to_map); 335 object->set_map(*new_to_map);
334 } 336 }
335 337
336 338
337 void Bootstrapper::DetachGlobal(Handle<Context> env) { 339 void Bootstrapper::DetachGlobal(Handle<Context> env) {
338 Factory* factory = env->GetIsolate()->factory(); 340 Factory* factory = env->GetIsolate()->factory();
339 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy())); 341 Handle<JSGlobalProxy> global_proxy(JSGlobalProxy::cast(env->global_proxy()));
340 global_proxy->set_native_context(*factory->null_value()); 342 global_proxy->set_native_context(*factory->null_value());
341 SetObjectPrototype(global_proxy, factory->null_value()); 343 SetObjectPrototype(global_proxy, factory->null_value());
342 env->set_global_proxy(env->global_object());
343 env->global_object()->set_global_receiver(env->global_object());
344 } 344 }
345 345
346 346
347 void Bootstrapper::ReattachGlobal(Handle<Context> env,
348 Handle<JSGlobalProxy> global_proxy) {
349 env->global_object()->set_global_receiver(*global_proxy);
350 env->set_global_proxy(*global_proxy);
351 SetObjectPrototype(global_proxy, Handle<JSObject>(env->global_object()));
352 global_proxy->set_native_context(*env);
353 }
354
355
356 static Handle<JSFunction> InstallFunction(Handle<JSObject> target, 347 static Handle<JSFunction> InstallFunction(Handle<JSObject> target,
357 const char* name, 348 const char* name,
358 InstanceType type, 349 InstanceType type,
359 int instance_size, 350 int instance_size,
360 Handle<JSObject> prototype, 351 Handle<JSObject> prototype,
361 Builtins::Name call, 352 Builtins::Name call,
362 bool install_initial_map, 353 bool install_initial_map,
363 bool set_instance_class_name) { 354 bool set_instance_class_name) {
364 Isolate* isolate = target->GetIsolate(); 355 Isolate* isolate = target->GetIsolate();
365 Factory* factory = isolate->factory(); 356 Factory* factory = isolate->factory();
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); 538 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
548 PropertyAttributes ro_attribs = 539 PropertyAttributes ro_attribs =
549 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 540 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
550 map->set_instance_descriptors(*descriptors); 541 map->set_instance_descriptors(*descriptors);
551 542
552 { // Add length. 543 { // Add length.
553 CallbacksDescriptor d(*factory()->length_string(), *length, ro_attribs); 544 CallbacksDescriptor d(*factory()->length_string(), *length, ro_attribs);
554 map->AppendDescriptor(&d, witness); 545 map->AppendDescriptor(&d, witness);
555 } 546 }
556 { // Add name. 547 { // Add name.
557 CallbacksDescriptor d(*factory()->name_string(), *name, rw_attribs); 548 CallbacksDescriptor d(*factory()->name_string(), *name, ro_attribs);
558 map->AppendDescriptor(&d, witness); 549 map->AppendDescriptor(&d, witness);
559 } 550 }
560 { // Add arguments. 551 { // Add arguments.
561 CallbacksDescriptor d(*factory()->arguments_string(), *arguments, 552 CallbacksDescriptor d(*factory()->arguments_string(), *arguments,
562 rw_attribs); 553 rw_attribs);
563 map->AppendDescriptor(&d, witness); 554 map->AppendDescriptor(&d, witness);
564 } 555 }
565 { // Add caller. 556 { // Add caller.
566 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs); 557 CallbacksDescriptor d(*factory()->caller_string(), *caller, rw_attribs);
567 map->AppendDescriptor(&d, witness); 558 map->AppendDescriptor(&d, witness);
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 factory->NewFunction(factory->empty_string(), JS_OBJECT_TYPE, 1295 factory->NewFunction(factory->empty_string(), JS_OBJECT_TYPE,
1305 JSObject::kHeaderSize, code, true); 1296 JSObject::kHeaderSize, code, true);
1306 native_context()->set_call_as_constructor_delegate(*delegate); 1297 native_context()->set_call_as_constructor_delegate(*delegate);
1307 delegate->shared()->DontAdaptArguments(); 1298 delegate->shared()->DontAdaptArguments();
1308 } 1299 }
1309 1300
1310 // Initialize the out of memory slot. 1301 // Initialize the out of memory slot.
1311 native_context()->set_out_of_memory(heap->false_value()); 1302 native_context()->set_out_of_memory(heap->false_value());
1312 1303
1313 // Initialize the embedder data slot. 1304 // Initialize the embedder data slot.
1314 Handle<FixedArray> embedder_data = factory->NewFixedArray(2); 1305 Handle<FixedArray> embedder_data = factory->NewFixedArray(3);
1315 native_context()->set_embedder_data(*embedder_data); 1306 native_context()->set_embedder_data(*embedder_data);
1316 } 1307 }
1317 1308
1318 1309
1319 Handle<JSFunction> Genesis::InstallTypedArray( 1310 Handle<JSFunction> Genesis::InstallTypedArray(
1320 const char* name, ElementsKind elementsKind) { 1311 const char* name, ElementsKind elementsKind) {
1321 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object()); 1312 Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
1322 Handle<JSFunction> result = InstallFunction(global, name, JS_TYPED_ARRAY_TYPE, 1313 Handle<JSFunction> result = InstallFunction(global, name, JS_TYPED_ARRAY_TYPE,
1323 JSTypedArray::kSize, isolate()->initial_object_prototype(), 1314 JSTypedArray::kSize, isolate()->initial_object_prototype(),
1324 Builtins::kIllegal, false, true); 1315 Builtins::kIllegal, false, true);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 bool use_runtime_context) { 1492 bool use_runtime_context) {
1502 Factory* factory = isolate->factory(); 1493 Factory* factory = isolate->factory();
1503 HandleScope scope(isolate); 1494 HandleScope scope(isolate);
1504 Handle<SharedFunctionInfo> function_info; 1495 Handle<SharedFunctionInfo> function_info;
1505 1496
1506 // If we can't find the function in the cache, we compile a new 1497 // If we can't find the function in the cache, we compile a new
1507 // function and insert it into the cache. 1498 // function and insert it into the cache.
1508 if (cache == NULL || !cache->Lookup(name, &function_info)) { 1499 if (cache == NULL || !cache->Lookup(name, &function_info)) {
1509 ASSERT(source->IsOneByteRepresentation()); 1500 ASSERT(source->IsOneByteRepresentation());
1510 Handle<String> script_name = factory->NewStringFromUtf8(name); 1501 Handle<String> script_name = factory->NewStringFromUtf8(name);
1511 function_info = Compiler::Compile( 1502 function_info = Compiler::CompileScript(
1512 source, 1503 source,
1513 script_name, 1504 script_name,
1514 0, 1505 0,
1515 0, 1506 0,
1516 false, 1507 false,
1517 top_context, 1508 top_context,
1518 extension, 1509 extension,
1519 NULL, 1510 NULL,
1520 Handle<String>::null(), 1511 Handle<String>::null(),
1521 use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE); 1512 use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE);
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 InstallExtension(isolate, "v8/free-buffer", &extension_states); 2250 InstallExtension(isolate, "v8/free-buffer", &extension_states);
2260 } 2251 }
2261 #endif 2252 #endif
2262 if (FLAG_expose_gc) InstallExtension(isolate, "v8/gc", &extension_states); 2253 if (FLAG_expose_gc) InstallExtension(isolate, "v8/gc", &extension_states);
2263 if (FLAG_expose_externalize_string) { 2254 if (FLAG_expose_externalize_string) {
2264 InstallExtension(isolate, "v8/externalize", &extension_states); 2255 InstallExtension(isolate, "v8/externalize", &extension_states);
2265 } 2256 }
2266 if (FLAG_track_gc_object_stats) { 2257 if (FLAG_track_gc_object_stats) {
2267 InstallExtension(isolate, "v8/statistics", &extension_states); 2258 InstallExtension(isolate, "v8/statistics", &extension_states);
2268 } 2259 }
2260 if (FLAG_expose_trigger_failure) {
2261 InstallExtension(isolate, "v8/trigger-failure", &extension_states);
2262 }
2269 2263
2270 if (extensions == NULL) return true; 2264 if (extensions == NULL) return true;
2271 // Install required extensions 2265 // Install required extensions
2272 int count = v8::ImplementationUtilities::GetNameCount(extensions); 2266 int count = v8::ImplementationUtilities::GetNameCount(extensions);
2273 const char** names = v8::ImplementationUtilities::GetNames(extensions); 2267 const char** names = v8::ImplementationUtilities::GetNames(extensions);
2274 for (int i = 0; i < count; i++) { 2268 for (int i = 0; i < count; i++) {
2275 if (!InstallExtension(isolate, names[i], &extension_states)) 2269 if (!InstallExtension(isolate, names[i], &extension_states))
2276 return false; 2270 return false;
2277 } 2271 }
2278 2272
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) { 2347 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
2354 HandleScope scope(isolate()); 2348 HandleScope scope(isolate());
2355 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { 2349 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
2356 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); 2350 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
2357 Handle<String> name = 2351 Handle<String> name =
2358 factory()->InternalizeUtf8String(Builtins::GetName(id)); 2352 factory()->InternalizeUtf8String(Builtins::GetName(id));
2359 Object* function_object = builtins->GetPropertyNoExceptionThrown(*name); 2353 Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
2360 Handle<JSFunction> function 2354 Handle<JSFunction> function
2361 = Handle<JSFunction>(JSFunction::cast(function_object)); 2355 = Handle<JSFunction>(JSFunction::cast(function_object));
2362 builtins->set_javascript_builtin(id, *function); 2356 builtins->set_javascript_builtin(id, *function);
2363 if (!JSFunction::CompileLazy(function, CLEAR_EXCEPTION)) { 2357 if (!Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) {
2364 return false; 2358 return false;
2365 } 2359 }
2366 builtins->set_javascript_builtin_code(id, function->shared()->code()); 2360 builtins->set_javascript_builtin_code(id, function->shared()->code());
2367 } 2361 }
2368 return true; 2362 return true;
2369 } 2363 }
2370 2364
2371 2365
2372 bool Genesis::ConfigureGlobalObjects( 2366 bool Genesis::ConfigureGlobalObjects(
2373 v8::Handle<v8::ObjectTemplate> global_proxy_template) { 2367 v8::Handle<v8::ObjectTemplate> global_proxy_template) {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 return from + sizeof(NestingCounterType); 2697 return from + sizeof(NestingCounterType);
2704 } 2698 }
2705 2699
2706 2700
2707 // Called when the top-level V8 mutex is destroyed. 2701 // Called when the top-level V8 mutex is destroyed.
2708 void Bootstrapper::FreeThreadResources() { 2702 void Bootstrapper::FreeThreadResources() {
2709 ASSERT(!IsActive()); 2703 ASSERT(!IsActive());
2710 } 2704 }
2711 2705
2712 } } // namespace v8::internal 2706 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.h ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698