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

Side by Side Diff: src/bootstrapper.cc

Issue 149458: Remove the descriptor stream abstractions.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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/factory.cc » ('j') | src/factory.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 TransferObject(obj, object); 1366 TransferObject(obj, object);
1367 return true; 1367 return true;
1368 } 1368 }
1369 1369
1370 1370
1371 void Genesis::TransferNamedProperties(Handle<JSObject> from, 1371 void Genesis::TransferNamedProperties(Handle<JSObject> from,
1372 Handle<JSObject> to) { 1372 Handle<JSObject> to) {
1373 if (from->HasFastProperties()) { 1373 if (from->HasFastProperties()) {
1374 Handle<DescriptorArray> descs = 1374 Handle<DescriptorArray> descs =
1375 Handle<DescriptorArray>(from->map()->instance_descriptors()); 1375 Handle<DescriptorArray>(from->map()->instance_descriptors());
1376 int offset = 0; 1376 for (int i = 0; i < descs->number_of_descriptors(); i++) {
1377 while (true) { 1377 PropertyDetails details = PropertyDetails(descs->GetDetails(i));
1378 // Iterating through the descriptors is not gc safe so we have to
1379 // store the value in a handle and create a new stream for each entry.
1380 DescriptorReader stream(*descs, offset);
1381 if (stream.eos()) break;
1382 // We have to read out the next offset before we do anything that may
1383 // cause a gc, since the DescriptorReader is not gc safe.
1384 offset = stream.next_position();
1385 PropertyDetails details = stream.GetDetails();
1386 switch (details.type()) { 1378 switch (details.type()) {
1387 case FIELD: { 1379 case FIELD: {
1388 HandleScope inner; 1380 HandleScope inner;
1389 Handle<String> key = Handle<String>(stream.GetKey()); 1381 Handle<String> key = Handle<String>(descs->GetKey(i));
1390 int index = stream.GetFieldIndex(); 1382 int index = descs->GetFieldIndex(i);
1391 Handle<Object> value = Handle<Object>(from->FastPropertyAt(index)); 1383 Handle<Object> value = Handle<Object>(from->FastPropertyAt(index));
1392 SetProperty(to, key, value, details.attributes()); 1384 SetProperty(to, key, value, details.attributes());
1393 break; 1385 break;
1394 } 1386 }
1395 case CONSTANT_FUNCTION: { 1387 case CONSTANT_FUNCTION: {
1396 HandleScope inner; 1388 HandleScope inner;
1397 Handle<String> key = Handle<String>(stream.GetKey()); 1389 Handle<String> key = Handle<String>(descs->GetKey(i));
1398 Handle<JSFunction> fun = 1390 Handle<JSFunction> fun =
1399 Handle<JSFunction>(stream.GetConstantFunction()); 1391 Handle<JSFunction>(descs->GetConstantFunction(i));
1400 SetProperty(to, key, fun, details.attributes()); 1392 SetProperty(to, key, fun, details.attributes());
1401 break; 1393 break;
1402 } 1394 }
1403 case CALLBACKS: { 1395 case CALLBACKS: {
1404 LookupResult result; 1396 LookupResult result;
1405 to->LocalLookup(stream.GetKey(), &result); 1397 to->LocalLookup(descs->GetKey(i), &result);
1406 // If the property is already there we skip it 1398 // If the property is already there we skip it
1407 if (result.IsValid()) continue; 1399 if (result.IsValid()) continue;
1408 HandleScope inner; 1400 HandleScope inner;
1409 Handle<DescriptorArray> inst_descs = 1401 Handle<DescriptorArray> inst_descs =
1410 Handle<DescriptorArray>(to->map()->instance_descriptors()); 1402 Handle<DescriptorArray>(to->map()->instance_descriptors());
1411 Handle<String> key = Handle<String>(stream.GetKey()); 1403 Handle<String> key = Handle<String>(descs->GetKey(i));
1412 Handle<Object> entry = Handle<Object>(stream.GetCallbacksObject()); 1404 Handle<Object> entry = Handle<Object>(descs->GetCallbacksObject(i));
1413 inst_descs = Factory::CopyAppendProxyDescriptor(inst_descs, 1405 inst_descs = Factory::CopyAppendProxyDescriptor(inst_descs,
1414 key, 1406 key,
1415 entry, 1407 entry,
1416 details.attributes()); 1408 details.attributes());
1417 to->map()->set_instance_descriptors(*inst_descs); 1409 to->map()->set_instance_descriptors(*inst_descs);
1418 break; 1410 break;
1419 } 1411 }
1420 case MAP_TRANSITION: 1412 case MAP_TRANSITION:
1421 case CONSTANT_TRANSITION: 1413 case CONSTANT_TRANSITION:
1422 case NULL_DESCRIPTOR: 1414 case NULL_DESCRIPTOR:
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 } 1608 }
1617 1609
1618 1610
1619 // Restore statics that are thread local. 1611 // Restore statics that are thread local.
1620 char* Genesis::RestoreState(char* from) { 1612 char* Genesis::RestoreState(char* from) {
1621 current_ = *reinterpret_cast<Genesis**>(from); 1613 current_ = *reinterpret_cast<Genesis**>(from);
1622 return from + sizeof(current_); 1614 return from + sizeof(current_);
1623 } 1615 }
1624 1616
1625 } } // namespace v8::internal 1617 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.cc » ('j') | src/factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698