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

Side by Side Diff: src/factory.cc

Issue 236823003: Reland "Handlify Runtime::InitializeIntrinsicFunctionNames." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix Created 6 years, 8 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 | « no previous file | src/heap.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 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 "factory.h" 5 #include "factory.h"
6 6
7 #include "isolate-inl.h" 7 #include "isolate-inl.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 Handle<Map> map = NewMap(JS_MODULE_TYPE, JSModule::kSize); 1311 Handle<Map> map = NewMap(JS_MODULE_TYPE, JSModule::kSize);
1312 // Allocate the object based on the map. 1312 // Allocate the object based on the map.
1313 Handle<JSModule> module = 1313 Handle<JSModule> module =
1314 Handle<JSModule>::cast(NewJSObjectFromMap(map, TENURED)); 1314 Handle<JSModule>::cast(NewJSObjectFromMap(map, TENURED));
1315 module->set_context(*context); 1315 module->set_context(*context);
1316 module->set_scope_info(*scope_info); 1316 module->set_scope_info(*scope_info);
1317 return module; 1317 return module;
1318 } 1318 }
1319 1319
1320 1320
1321 // TODO(mstarzinger): Temporary wrapper until handlified.
1322 static Handle<NameDictionary> NameDictionaryAdd(Handle<NameDictionary> dict,
1323 Handle<Name> name,
1324 Handle<Object> value,
1325 PropertyDetails details) {
1326 CALL_HEAP_FUNCTION(dict->GetIsolate(),
1327 dict->Add(*name, *value, details),
1328 NameDictionary);
1329 }
1330
1331
1332 static Handle<GlobalObject> NewGlobalObjectFromMap(Isolate* isolate, 1321 static Handle<GlobalObject> NewGlobalObjectFromMap(Isolate* isolate,
1333 Handle<Map> map) { 1322 Handle<Map> map) {
1334 CALL_HEAP_FUNCTION(isolate, 1323 CALL_HEAP_FUNCTION(isolate,
1335 isolate->heap()->Allocate(*map, OLD_POINTER_SPACE), 1324 isolate->heap()->Allocate(*map, OLD_POINTER_SPACE),
1336 GlobalObject); 1325 GlobalObject);
1337 } 1326 }
1338 1327
1339 1328
1340 Handle<GlobalObject> Factory::NewGlobalObject(Handle<JSFunction> constructor) { 1329 Handle<GlobalObject> Factory::NewGlobalObject(Handle<JSFunction> constructor) {
1341 ASSERT(constructor->has_initial_map()); 1330 ASSERT(constructor->has_initial_map());
(...skipping 22 matching lines...) Expand all
1364 // The global object might be created from an object template with accessors. 1353 // The global object might be created from an object template with accessors.
1365 // Fill these accessors into the dictionary. 1354 // Fill these accessors into the dictionary.
1366 Handle<DescriptorArray> descs(map->instance_descriptors()); 1355 Handle<DescriptorArray> descs(map->instance_descriptors());
1367 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { 1356 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) {
1368 PropertyDetails details = descs->GetDetails(i); 1357 PropertyDetails details = descs->GetDetails(i);
1369 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. 1358 ASSERT(details.type() == CALLBACKS); // Only accessors are expected.
1370 PropertyDetails d = PropertyDetails(details.attributes(), CALLBACKS, i + 1); 1359 PropertyDetails d = PropertyDetails(details.attributes(), CALLBACKS, i + 1);
1371 Handle<Name> name(descs->GetKey(i)); 1360 Handle<Name> name(descs->GetKey(i));
1372 Handle<Object> value(descs->GetCallbacksObject(i), isolate()); 1361 Handle<Object> value(descs->GetCallbacksObject(i), isolate());
1373 Handle<PropertyCell> cell = NewPropertyCell(value); 1362 Handle<PropertyCell> cell = NewPropertyCell(value);
1374 NameDictionaryAdd(dictionary, name, cell, d); 1363 NameDictionary::AddNameEntry(dictionary, name, cell, d);
1375 } 1364 }
1376 1365
1377 // Allocate the global object and initialize it with the backing store. 1366 // Allocate the global object and initialize it with the backing store.
1378 Handle<GlobalObject> global = NewGlobalObjectFromMap(isolate(), map); 1367 Handle<GlobalObject> global = NewGlobalObjectFromMap(isolate(), map);
1379 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); 1368 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map);
1380 1369
1381 // Create a new map for the global object. 1370 // Create a new map for the global object.
1382 Handle<Map> new_map = Map::CopyDropDescriptors(map); 1371 Handle<Map> new_map = Map::CopyDropDescriptors(map);
1383 new_map->set_dictionary_map(true); 1372 new_map->set_dictionary_map(true);
1384 1373
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 if (String::Equals(name, infinity_string())) return infinity_value(); 1968 if (String::Equals(name, infinity_string())) return infinity_value();
1980 return Handle<Object>::null(); 1969 return Handle<Object>::null();
1981 } 1970 }
1982 1971
1983 1972
1984 Handle<Object> Factory::ToBoolean(bool value) { 1973 Handle<Object> Factory::ToBoolean(bool value) {
1985 return value ? true_value() : false_value(); 1974 return value ? true_value() : false_value();
1986 } 1975 }
1987 1976
1988 } } // namespace v8::internal 1977 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698