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

Side by Side Diff: src/objects.cc

Issue 12223071: ES6 symbols: Introduce Symbol class, along with abstract Name class (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 else if (IsNull()) 1311 else if (IsNull())
1312 accumulator->Add("<null>"); 1312 accumulator->Add("<null>");
1313 else if (IsTrue()) 1313 else if (IsTrue())
1314 accumulator->Add("<true>"); 1314 accumulator->Add("<true>");
1315 else if (IsFalse()) 1315 else if (IsFalse())
1316 accumulator->Add("<false>"); 1316 accumulator->Add("<false>");
1317 else 1317 else
1318 accumulator->Add("<Odd Oddball>"); 1318 accumulator->Add("<Odd Oddball>");
1319 break; 1319 break;
1320 } 1320 }
1321 case SYMBOL_TYPE:
1322 accumulator->Add("<Symbol: %d>", Symbol::cast(this)->Hash());
1323 break;
1321 case HEAP_NUMBER_TYPE: 1324 case HEAP_NUMBER_TYPE:
1322 accumulator->Add("<Number: "); 1325 accumulator->Add("<Number: ");
1323 HeapNumber::cast(this)->HeapNumberPrint(accumulator); 1326 HeapNumber::cast(this)->HeapNumberPrint(accumulator);
1324 accumulator->Put('>'); 1327 accumulator->Put('>');
1325 break; 1328 break;
1326 case JS_PROXY_TYPE: 1329 case JS_PROXY_TYPE:
1327 accumulator->Add("<JSProxy>"); 1330 accumulator->Add("<JSProxy>");
1328 break; 1331 break;
1329 case JS_FUNCTION_PROXY_TYPE: 1332 case JS_FUNCTION_PROXY_TYPE:
1330 accumulator->Add("<JSFunctionProxy>"); 1333 accumulator->Add("<JSFunctionProxy>");
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 break; 1422 break;
1420 case MAP_TYPE: 1423 case MAP_TYPE:
1421 Map::BodyDescriptor::IterateBody(this, v); 1424 Map::BodyDescriptor::IterateBody(this, v);
1422 break; 1425 break;
1423 case CODE_TYPE: 1426 case CODE_TYPE:
1424 reinterpret_cast<Code*>(this)->CodeIterateBody(v); 1427 reinterpret_cast<Code*>(this)->CodeIterateBody(v);
1425 break; 1428 break;
1426 case JS_GLOBAL_PROPERTY_CELL_TYPE: 1429 case JS_GLOBAL_PROPERTY_CELL_TYPE:
1427 JSGlobalPropertyCell::BodyDescriptor::IterateBody(this, v); 1430 JSGlobalPropertyCell::BodyDescriptor::IterateBody(this, v);
1428 break; 1431 break;
1432 case SYMBOL_TYPE:
1429 case HEAP_NUMBER_TYPE: 1433 case HEAP_NUMBER_TYPE:
1430 case FILLER_TYPE: 1434 case FILLER_TYPE:
1431 case BYTE_ARRAY_TYPE: 1435 case BYTE_ARRAY_TYPE:
1432 case FREE_SPACE_TYPE: 1436 case FREE_SPACE_TYPE:
1433 case EXTERNAL_PIXEL_ARRAY_TYPE: 1437 case EXTERNAL_PIXEL_ARRAY_TYPE:
1434 case EXTERNAL_BYTE_ARRAY_TYPE: 1438 case EXTERNAL_BYTE_ARRAY_TYPE:
1435 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: 1439 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
1436 case EXTERNAL_SHORT_ARRAY_TYPE: 1440 case EXTERNAL_SHORT_ARRAY_TYPE:
1437 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: 1441 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
1438 case EXTERNAL_INT_ARRAY_TYPE: 1442 case EXTERNAL_INT_ARRAY_TYPE:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 } 1477 }
1474 if (u.bits.exp == 0) { 1478 if (u.bits.exp == 0) {
1475 // Detect +0, and -0 for IEEE double precision floating point. 1479 // Detect +0, and -0 for IEEE double precision floating point.
1476 if ((u.bits.man_low | u.bits.man_high) == 0) 1480 if ((u.bits.man_low | u.bits.man_high) == 0)
1477 return GetHeap()->false_value(); 1481 return GetHeap()->false_value();
1478 } 1482 }
1479 return GetHeap()->true_value(); 1483 return GetHeap()->true_value();
1480 } 1484 }
1481 1485
1482 1486
1487 void Symbol::SymbolPrint(FILE* out) {
1488 HeapObject::PrintHeader(out, "Symbol");
1489 PrintF(out, " - hash: %d\n", Hash());
1490 }
1491
1492
1483 void HeapNumber::HeapNumberPrint(FILE* out) { 1493 void HeapNumber::HeapNumberPrint(FILE* out) {
1484 PrintF(out, "%.16g", Number()); 1494 PrintF(out, "%.16g", Number());
1485 } 1495 }
1486 1496
1487 1497
1488 void HeapNumber::HeapNumberPrint(StringStream* accumulator) { 1498 void HeapNumber::HeapNumberPrint(StringStream* accumulator) {
1489 // The Windows version of vsnprintf can allocate when printing a %g string 1499 // The Windows version of vsnprintf can allocate when printing a %g string
1490 // into a buffer that may not be big enough. We don't want random memory 1500 // into a buffer that may not be big enough. We don't want random memory
1491 // allocation when producing post-crash stack traces, so we print into a 1501 // allocation when producing post-crash stack traces, so we print into a
1492 // buffer that is plenty big enough for any floating point number, then 1502 // buffer that is plenty big enough for any floating point number, then
(...skipping 12404 matching lines...) Expand 10 before | Expand all | Expand 10 after
13897 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13907 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13898 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13908 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13899 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13909 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13900 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13910 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13901 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13911 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13902 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13912 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13903 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13913 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13904 } 13914 }
13905 13915
13906 } } // namespace v8::internal 13916 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698