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

Side by Side Diff: src/heap.cc

Issue 660095: Merge revision 3813 to 3930 from bleeding_edge to partial snapshots branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: '' Created 10 years, 9 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/heap.h ('k') | src/ia32/assembler-ia32.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 1491
1492 1492
1493 #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP 1493 #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP
1494 void Heap::CreateRegExpCEntryStub() { 1494 void Heap::CreateRegExpCEntryStub() {
1495 RegExpCEntryStub stub; 1495 RegExpCEntryStub stub;
1496 set_re_c_entry_code(*stub.GetCode()); 1496 set_re_c_entry_code(*stub.GetCode());
1497 } 1497 }
1498 #endif 1498 #endif
1499 1499
1500 1500
1501 #ifdef ENABLE_DEBUGGER_SUPPORT
1502 void Heap::CreateCEntryDebugBreakStub() {
1503 DebuggerStatementStub stub;
1504 set_debugger_statement_code(*stub.GetCode());
1505 }
1506 #endif
1507
1508
1509 void Heap::CreateJSEntryStub() { 1501 void Heap::CreateJSEntryStub() {
1510 JSEntryStub stub; 1502 JSEntryStub stub;
1511 set_js_entry_code(*stub.GetCode()); 1503 set_js_entry_code(*stub.GetCode());
1512 } 1504 }
1513 1505
1514 1506
1515 void Heap::CreateJSConstructEntryStub() { 1507 void Heap::CreateJSConstructEntryStub() {
1516 JSConstructEntryStub stub; 1508 JSConstructEntryStub stub;
1517 set_js_construct_entry_code(*stub.GetCode()); 1509 set_js_construct_entry_code(*stub.GetCode());
1518 } 1510 }
1519 1511
1520 1512
1521 void Heap::CreateFixedStubs() { 1513 void Heap::CreateFixedStubs() {
1522 // Here we create roots for fixed stubs. They are needed at GC 1514 // Here we create roots for fixed stubs. They are needed at GC
1523 // for cooking and uncooking (check out frames.cc). 1515 // for cooking and uncooking (check out frames.cc).
1524 // The eliminates the need for doing dictionary lookup in the 1516 // The eliminates the need for doing dictionary lookup in the
1525 // stub cache for these stubs. 1517 // stub cache for these stubs.
1526 HandleScope scope; 1518 HandleScope scope;
1527 // gcc-4.4 has problem generating correct code of following snippet: 1519 // gcc-4.4 has problem generating correct code of following snippet:
1528 // { CEntryStub stub; 1520 // { CEntryStub stub;
1529 // c_entry_code_ = *stub.GetCode(); 1521 // c_entry_code_ = *stub.GetCode();
1530 // } 1522 // }
1531 // { DebuggerStatementStub stub; 1523 // { DebuggerStatementStub stub;
1532 // debugger_statement_code_ = *stub.GetCode(); 1524 // debugger_statement_code_ = *stub.GetCode();
1533 // } 1525 // }
1534 // To workaround the problem, make separate functions without inlining. 1526 // To workaround the problem, make separate functions without inlining.
1535 Heap::CreateCEntryStub(); 1527 Heap::CreateCEntryStub();
1536 #ifdef ENABLE_DEBUGGER_SUPPORT
1537 Heap::CreateCEntryDebugBreakStub();
1538 #endif
1539 Heap::CreateJSEntryStub(); 1528 Heap::CreateJSEntryStub();
1540 Heap::CreateJSConstructEntryStub(); 1529 Heap::CreateJSConstructEntryStub();
1541 #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP 1530 #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP
1542 Heap::CreateRegExpCEntryStub(); 1531 Heap::CreateRegExpCEntryStub();
1543 #endif 1532 #endif
1544 } 1533 }
1545 1534
1546 1535
1547 bool Heap::CreateInitialObjects() { 1536 bool Heap::CreateInitialObjects() {
1548 Object* obj; 1537 Object* obj;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) { 1760 if (value == FastI2D(int_value) && Smi::IsValid(int_value)) {
1772 return Smi::FromInt(int_value); 1761 return Smi::FromInt(int_value);
1773 } 1762 }
1774 1763
1775 // Materialize the value in the heap. 1764 // Materialize the value in the heap.
1776 return AllocateHeapNumber(value, pretenure); 1765 return AllocateHeapNumber(value, pretenure);
1777 } 1766 }
1778 1767
1779 1768
1780 Object* Heap::NumberToString(Object* number) { 1769 Object* Heap::NumberToString(Object* number) {
1770 Counters::number_to_string_runtime.Increment();
1781 Object* cached = GetNumberStringCache(number); 1771 Object* cached = GetNumberStringCache(number);
1782 if (cached != undefined_value()) { 1772 if (cached != undefined_value()) {
1783 return cached; 1773 return cached;
1784 } 1774 }
1785 1775
1786 char arr[100]; 1776 char arr[100];
1787 Vector<char> buffer(arr, ARRAY_SIZE(arr)); 1777 Vector<char> buffer(arr, ARRAY_SIZE(arr));
1788 const char* str; 1778 const char* str;
1789 if (number->IsSmi()) { 1779 if (number->IsSmi()) {
1790 int num = Smi::cast(number)->value(); 1780 int num = Smi::cast(number)->value();
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 prototype = fun->instance_prototype(); 2376 prototype = fun->instance_prototype();
2387 } else { 2377 } else {
2388 prototype = AllocateFunctionPrototype(fun); 2378 prototype = AllocateFunctionPrototype(fun);
2389 if (prototype->IsFailure()) return prototype; 2379 if (prototype->IsFailure()) return prototype;
2390 } 2380 }
2391 Map* map = Map::cast(map_obj); 2381 Map* map = Map::cast(map_obj);
2392 map->set_inobject_properties(in_object_properties); 2382 map->set_inobject_properties(in_object_properties);
2393 map->set_unused_property_fields(in_object_properties); 2383 map->set_unused_property_fields(in_object_properties);
2394 map->set_prototype(prototype); 2384 map->set_prototype(prototype);
2395 2385
2396 // If the function has only simple this property assignments add field 2386 // If the function has only simple this property assignments add
2397 // descriptors for these to the initial map as the object cannot be 2387 // field descriptors for these to the initial map as the object
2398 // constructed without having these properties. 2388 // cannot be constructed without having these properties. Guard by
2389 // the inline_new flag so we only change the map if we generate a
2390 // specialized construct stub.
2399 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); 2391 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields);
2400 if (fun->shared()->has_only_simple_this_property_assignments() && 2392 if (fun->shared()->CanGenerateInlineConstructor(prototype)) {
2401 fun->shared()->this_property_assignments_count() > 0) {
2402 int count = fun->shared()->this_property_assignments_count(); 2393 int count = fun->shared()->this_property_assignments_count();
2403 if (count > in_object_properties) { 2394 if (count > in_object_properties) {
2404 count = in_object_properties; 2395 count = in_object_properties;
2405 } 2396 }
2406 Object* descriptors_obj = DescriptorArray::Allocate(count); 2397 Object* descriptors_obj = DescriptorArray::Allocate(count);
2407 if (descriptors_obj->IsFailure()) return descriptors_obj; 2398 if (descriptors_obj->IsFailure()) return descriptors_obj;
2408 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_obj); 2399 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_obj);
2409 for (int i = 0; i < count; i++) { 2400 for (int i = 0; i < count; i++) {
2410 String* name = fun->shared()->GetThisPropertyAssignmentName(i); 2401 String* name = fun->shared()->GetThisPropertyAssignmentName(i);
2411 ASSERT(name->IsSymbol()); 2402 ASSERT(name->IsSymbol());
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
4113 : "Mark-sweep"; 4104 : "Mark-sweep";
4114 } 4105 }
4115 return "Unknown GC"; 4106 return "Unknown GC";
4116 } 4107 }
4117 4108
4118 4109
4119 int KeyedLookupCache::Hash(Map* map, String* name) { 4110 int KeyedLookupCache::Hash(Map* map, String* name) {
4120 // Uses only lower 32 bits if pointers are larger. 4111 // Uses only lower 32 bits if pointers are larger.
4121 uintptr_t addr_hash = 4112 uintptr_t addr_hash =
4122 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)) >> kMapHashShift; 4113 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)) >> kMapHashShift;
4123 return (addr_hash ^ name->Hash()) & kCapacityMask; 4114 return static_cast<uint32_t>((addr_hash ^ name->Hash()) & kCapacityMask);
4124 } 4115 }
4125 4116
4126 4117
4127 int KeyedLookupCache::Lookup(Map* map, String* name) { 4118 int KeyedLookupCache::Lookup(Map* map, String* name) {
4128 int index = Hash(map, name); 4119 int index = Hash(map, name);
4129 Key& key = keys_[index]; 4120 Key& key = keys_[index];
4130 if ((key.map == map) && key.name->Equals(name)) { 4121 if ((key.map == map) && key.name->Equals(name)) {
4131 return field_offsets_[index]; 4122 return field_offsets_[index];
4132 } 4123 }
4133 return -1; 4124 return -1;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
4228 void ExternalStringTable::TearDown() { 4219 void ExternalStringTable::TearDown() {
4229 new_space_strings_.Free(); 4220 new_space_strings_.Free();
4230 old_space_strings_.Free(); 4221 old_space_strings_.Free();
4231 } 4222 }
4232 4223
4233 4224
4234 List<Object*> ExternalStringTable::new_space_strings_; 4225 List<Object*> ExternalStringTable::new_space_strings_;
4235 List<Object*> ExternalStringTable::old_space_strings_; 4226 List<Object*> ExternalStringTable::old_space_strings_;
4236 4227
4237 } } // namespace v8::internal 4228 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/ia32/assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698