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

Side by Side Diff: src/heap.cc

Issue 6606006: [Isolates] Merge 6500:6700 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 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/heap-profiler.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 Map* global_context_map = Map::cast(obj); 1795 Map* global_context_map = Map::cast(obj);
1796 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext); 1796 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext);
1797 set_global_context_map(global_context_map); 1797 set_global_context_map(global_context_map);
1798 1798
1799 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, 1799 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE,
1800 SharedFunctionInfo::kAlignedSize); 1800 SharedFunctionInfo::kAlignedSize);
1801 if (!maybe_obj->ToObject(&obj)) return false; 1801 if (!maybe_obj->ToObject(&obj)) return false;
1802 } 1802 }
1803 set_shared_function_info_map(Map::cast(obj)); 1803 set_shared_function_info_map(Map::cast(obj));
1804 1804
1805 { MaybeObject* maybe_obj = AllocateMap(JS_MESSAGE_OBJECT_TYPE,
1806 JSMessageObject::kSize);
1807 if (!maybe_obj->ToObject(&obj)) return false;
1808 }
1809 set_message_object_map(Map::cast(obj));
1810
1805 ASSERT(!InNewSpace(empty_fixed_array())); 1811 ASSERT(!InNewSpace(empty_fixed_array()));
1806 return true; 1812 return true;
1807 } 1813 }
1808 1814
1809 1815
1810 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) { 1816 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) {
1811 // Statically ensure that it is safe to allocate heap numbers in paged 1817 // Statically ensure that it is safe to allocate heap numbers in paged
1812 // spaces. 1818 // spaces.
1813 STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxHeapObjectSize); 1819 STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxHeapObjectSize);
1814 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 1820 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 set_js_entry_code(*stub.GetCode()); 1913 set_js_entry_code(*stub.GetCode());
1908 } 1914 }
1909 1915
1910 1916
1911 void Heap::CreateJSConstructEntryStub() { 1917 void Heap::CreateJSConstructEntryStub() {
1912 JSConstructEntryStub stub; 1918 JSConstructEntryStub stub;
1913 set_js_construct_entry_code(*stub.GetCode()); 1919 set_js_construct_entry_code(*stub.GetCode());
1914 } 1920 }
1915 1921
1916 1922
1923 #if V8_TARGET_ARCH_ARM
1924 void Heap::CreateDirectCEntryStub() {
1925 DirectCEntryStub stub;
1926 set_direct_c_entry_code(*stub.GetCode());
1927 }
1928 #endif
1929
1930
1917 void Heap::CreateFixedStubs() { 1931 void Heap::CreateFixedStubs() {
1918 // Here we create roots for fixed stubs. They are needed at GC 1932 // Here we create roots for fixed stubs. They are needed at GC
1919 // for cooking and uncooking (check out frames.cc). 1933 // for cooking and uncooking (check out frames.cc).
1920 // The eliminates the need for doing dictionary lookup in the 1934 // The eliminates the need for doing dictionary lookup in the
1921 // stub cache for these stubs. 1935 // stub cache for these stubs.
1922 HandleScope scope; 1936 HandleScope scope;
1923 // gcc-4.4 has problem generating correct code of following snippet: 1937 // gcc-4.4 has problem generating correct code of following snippet:
1924 // { CEntryStub stub; 1938 // { CEntryStub stub;
1925 // c_entry_code_ = *stub.GetCode(); 1939 // c_entry_code_ = *stub.GetCode();
1926 // } 1940 // }
1927 // { DebuggerStatementStub stub; 1941 // { DebuggerStatementStub stub;
1928 // debugger_statement_code_ = *stub.GetCode(); 1942 // debugger_statement_code_ = *stub.GetCode();
1929 // } 1943 // }
1930 // To workaround the problem, make separate functions without inlining. 1944 // To workaround the problem, make separate functions without inlining.
1931 CreateCEntryStub(); 1945 CreateCEntryStub();
1932 CreateJSEntryStub(); 1946 CreateJSEntryStub();
1933 CreateJSConstructEntryStub(); 1947 CreateJSConstructEntryStub();
1934 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP 1948 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP
1935 CreateRegExpCEntryStub(); 1949 CreateRegExpCEntryStub();
1936 #endif 1950 #endif
1951 #if V8_TARGET_ARCH_ARM
1952 Heap::CreateDirectCEntryStub();
1953 #endif
1937 } 1954 }
1938 1955
1939 1956
1940 bool Heap::CreateInitialObjects() { 1957 bool Heap::CreateInitialObjects() {
1941 Object* obj; 1958 Object* obj;
1942 1959
1943 // The -0 value must be set before NumberFromDouble works. 1960 // The -0 value must be set before NumberFromDouble works.
1944 { MaybeObject* maybe_obj = AllocateHeapNumber(-0.0, TENURED); 1961 { MaybeObject* maybe_obj = AllocateHeapNumber(-0.0, TENURED);
1945 if (!maybe_obj->ToObject(&obj)) return false; 1962 if (!maybe_obj->ToObject(&obj)) return false;
1946 } 1963 }
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 share->set_this_property_assignments_count(0); 2330 share->set_this_property_assignments_count(0);
2314 share->set_this_property_assignments(undefined_value()); 2331 share->set_this_property_assignments(undefined_value());
2315 share->set_opt_count(0); 2332 share->set_opt_count(0);
2316 share->set_num_literals(0); 2333 share->set_num_literals(0);
2317 share->set_end_position(0); 2334 share->set_end_position(0);
2318 share->set_function_token_position(0); 2335 share->set_function_token_position(0);
2319 return result; 2336 return result;
2320 } 2337 }
2321 2338
2322 2339
2340 MaybeObject* Heap::AllocateJSMessageObject(String* type,
2341 JSArray* arguments,
2342 int start_position,
2343 int end_position,
2344 Object* script,
2345 Object* stack_trace,
2346 Object* stack_frames) {
2347 Object* result;
2348 { MaybeObject* maybe_result = Allocate(message_object_map(), NEW_SPACE);
2349 if (!maybe_result->ToObject(&result)) return maybe_result;
2350 }
2351 JSMessageObject* message = JSMessageObject::cast(result);
2352 message->set_properties(Heap::empty_fixed_array());
2353 message->set_elements(Heap::empty_fixed_array());
2354 message->set_type(type);
2355 message->set_arguments(arguments);
2356 message->set_start_position(start_position);
2357 message->set_end_position(end_position);
2358 message->set_script(script);
2359 message->set_stack_trace(stack_trace);
2360 message->set_stack_frames(stack_frames);
2361 return result;
2362 }
2363
2364
2365
2323 // Returns true for a character in a range. Both limits are inclusive. 2366 // Returns true for a character in a range. Both limits are inclusive.
2324 static inline bool Between(uint32_t character, uint32_t from, uint32_t to) { 2367 static inline bool Between(uint32_t character, uint32_t from, uint32_t to) {
2325 // This makes uses of the the unsigned wraparound. 2368 // This makes uses of the the unsigned wraparound.
2326 return character - from <= to - from; 2369 return character - from <= to - from;
2327 } 2370 }
2328 2371
2329 2372
2330 MUST_USE_RESULT static inline MaybeObject* MakeOrFindTwoCharacterString( 2373 MUST_USE_RESULT static inline MaybeObject* MakeOrFindTwoCharacterString(
2331 Heap* heap, 2374 Heap* heap,
2332 uint32_t c1, 2375 uint32_t c1,
(...skipping 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after
4095 if (string->IsSymbol()) { 4138 if (string->IsSymbol()) {
4096 *symbol = string; 4139 *symbol = string;
4097 return true; 4140 return true;
4098 } 4141 }
4099 return symbol_table()->LookupSymbolIfExists(string, symbol); 4142 return symbol_table()->LookupSymbolIfExists(string, symbol);
4100 } 4143 }
4101 4144
4102 4145
4103 #ifdef DEBUG 4146 #ifdef DEBUG
4104 void Heap::ZapFromSpace() { 4147 void Heap::ZapFromSpace() {
4105 ASSERT(reinterpret_cast<Object*>(kFromSpaceZapValue)->IsHeapObject()); 4148 ASSERT(reinterpret_cast<Object*>(kFromSpaceZapValue)->IsFailure());
4106 for (Address a = new_space_.FromSpaceLow(); 4149 for (Address a = new_space_.FromSpaceLow();
4107 a < new_space_.FromSpaceHigh(); 4150 a < new_space_.FromSpaceHigh();
4108 a += kPointerSize) { 4151 a += kPointerSize) {
4109 Memory::Address_at(a) = kFromSpaceZapValue; 4152 Memory::Address_at(a) = kFromSpaceZapValue;
4110 } 4153 }
4111 } 4154 }
4112 #endif // DEBUG 4155 #endif // DEBUG
4113 4156
4114 4157
4115 bool Heap::IteratePointersInDirtyRegion(Heap* heap, 4158 bool Heap::IteratePointersInDirtyRegion(Heap* heap,
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
5608 } 5651 }
5609 5652
5610 5653
5611 void ExternalStringTable::TearDown() { 5654 void ExternalStringTable::TearDown() {
5612 new_space_strings_.Free(); 5655 new_space_strings_.Free();
5613 old_space_strings_.Free(); 5656 old_space_strings_.Free();
5614 } 5657 }
5615 5658
5616 5659
5617 } } // namespace v8::internal 5660 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698