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

Side by Side Diff: src/factory.cc

Issue 236343005: Revert "Handlify Runtime::InitializeIntrinsicFunctionNames." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
1321 static Handle<GlobalObject> NewGlobalObjectFromMap(Isolate* isolate, 1332 static Handle<GlobalObject> NewGlobalObjectFromMap(Isolate* isolate,
1322 Handle<Map> map) { 1333 Handle<Map> map) {
1323 CALL_HEAP_FUNCTION(isolate, 1334 CALL_HEAP_FUNCTION(isolate,
1324 isolate->heap()->Allocate(*map, OLD_POINTER_SPACE), 1335 isolate->heap()->Allocate(*map, OLD_POINTER_SPACE),
1325 GlobalObject); 1336 GlobalObject);
1326 } 1337 }
1327 1338
1328 1339
1329 Handle<GlobalObject> Factory::NewGlobalObject(Handle<JSFunction> constructor) { 1340 Handle<GlobalObject> Factory::NewGlobalObject(Handle<JSFunction> constructor) {
1330 ASSERT(constructor->has_initial_map()); 1341 ASSERT(constructor->has_initial_map());
(...skipping 22 matching lines...) Expand all
1353 // The global object might be created from an object template with accessors. 1364 // The global object might be created from an object template with accessors.
1354 // Fill these accessors into the dictionary. 1365 // Fill these accessors into the dictionary.
1355 Handle<DescriptorArray> descs(map->instance_descriptors()); 1366 Handle<DescriptorArray> descs(map->instance_descriptors());
1356 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { 1367 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) {
1357 PropertyDetails details = descs->GetDetails(i); 1368 PropertyDetails details = descs->GetDetails(i);
1358 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. 1369 ASSERT(details.type() == CALLBACKS); // Only accessors are expected.
1359 PropertyDetails d = PropertyDetails(details.attributes(), CALLBACKS, i + 1); 1370 PropertyDetails d = PropertyDetails(details.attributes(), CALLBACKS, i + 1);
1360 Handle<Name> name(descs->GetKey(i)); 1371 Handle<Name> name(descs->GetKey(i));
1361 Handle<Object> value(descs->GetCallbacksObject(i), isolate()); 1372 Handle<Object> value(descs->GetCallbacksObject(i), isolate());
1362 Handle<PropertyCell> cell = NewPropertyCell(value); 1373 Handle<PropertyCell> cell = NewPropertyCell(value);
1363 NameDictionary::Add(dictionary, name, cell, d); 1374 NameDictionaryAdd(dictionary, name, cell, d);
1364 } 1375 }
1365 1376
1366 // Allocate the global object and initialize it with the backing store. 1377 // Allocate the global object and initialize it with the backing store.
1367 Handle<GlobalObject> global = NewGlobalObjectFromMap(isolate(), map); 1378 Handle<GlobalObject> global = NewGlobalObjectFromMap(isolate(), map);
1368 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); 1379 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map);
1369 1380
1370 // Create a new map for the global object. 1381 // Create a new map for the global object.
1371 Handle<Map> new_map = Map::CopyDropDescriptors(map); 1382 Handle<Map> new_map = Map::CopyDropDescriptors(map);
1372 new_map->set_dictionary_map(true); 1383 new_map->set_dictionary_map(true);
1373 1384
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 if (String::Equals(name, infinity_string())) return infinity_value(); 1979 if (String::Equals(name, infinity_string())) return infinity_value();
1969 return Handle<Object>::null(); 1980 return Handle<Object>::null();
1970 } 1981 }
1971 1982
1972 1983
1973 Handle<Object> Factory::ToBoolean(bool value) { 1984 Handle<Object> Factory::ToBoolean(bool value) {
1974 return value ? true_value() : false_value(); 1985 return value ? true_value() : false_value();
1975 } 1986 }
1976 1987
1977 } } // namespace v8::internal 1988 } } // 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