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

Side by Side Diff: src/heap.cc

Issue 6368051: A MessageObject is a purely internal object to hold information about (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 9 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
« no previous file with comments | « src/heap.h ('k') | src/messages.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 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 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 Map* global_context_map = Map::cast(obj); 1819 Map* global_context_map = Map::cast(obj);
1820 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext); 1820 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext);
1821 set_global_context_map(global_context_map); 1821 set_global_context_map(global_context_map);
1822 1822
1823 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, 1823 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE,
1824 SharedFunctionInfo::kAlignedSize); 1824 SharedFunctionInfo::kAlignedSize);
1825 if (!maybe_obj->ToObject(&obj)) return false; 1825 if (!maybe_obj->ToObject(&obj)) return false;
1826 } 1826 }
1827 set_shared_function_info_map(Map::cast(obj)); 1827 set_shared_function_info_map(Map::cast(obj));
1828 1828
1829 { MaybeObject* maybe_obj = AllocateMap(JS_MESSAGE_OBJECT_TYPE,
1830 JSMessageObject::kSize);
1831 if (!maybe_obj->ToObject(&obj)) return false;
1832 }
1833 set_message_object_map(Map::cast(obj));
1834
1829 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); 1835 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array()));
1830 return true; 1836 return true;
1831 } 1837 }
1832 1838
1833 1839
1834 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) { 1840 MaybeObject* Heap::AllocateHeapNumber(double value, PretenureFlag pretenure) {
1835 // Statically ensure that it is safe to allocate heap numbers in paged 1841 // Statically ensure that it is safe to allocate heap numbers in paged
1836 // spaces. 1842 // spaces.
1837 STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxHeapObjectSize); 1843 STATIC_ASSERT(HeapNumber::kSize <= Page::kMaxHeapObjectSize);
1838 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; 1844 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE;
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 share->set_this_property_assignments_count(0); 2328 share->set_this_property_assignments_count(0);
2323 share->set_this_property_assignments(undefined_value()); 2329 share->set_this_property_assignments(undefined_value());
2324 share->set_opt_count(0); 2330 share->set_opt_count(0);
2325 share->set_num_literals(0); 2331 share->set_num_literals(0);
2326 share->set_end_position(0); 2332 share->set_end_position(0);
2327 share->set_function_token_position(0); 2333 share->set_function_token_position(0);
2328 return result; 2334 return result;
2329 } 2335 }
2330 2336
2331 2337
2338 MaybeObject* Heap::AllocateJSMessageObject(String* type,
2339 JSArray* arguments,
2340 int start_position,
2341 int end_position,
2342 Object* script,
2343 Object* stack_trace,
2344 Object* stack_frames) {
2345 Object* result;
2346 { MaybeObject* maybe_result = Allocate(message_object_map(), NEW_SPACE);
2347 if (!maybe_result->ToObject(&result)) return maybe_result;
2348 }
2349 JSMessageObject* message = JSMessageObject::cast(result);
2350 message->set_properties(Heap::empty_fixed_array());
2351 message->set_elements(Heap::empty_fixed_array());
2352 message->set_type(type);
2353 message->set_arguments(arguments);
2354 message->set_start_position(start_position);
2355 message->set_end_position(end_position);
2356 message->set_script(script);
2357 message->set_stack_trace(stack_trace);
2358 message->set_stack_frames(stack_frames);
2359 return result;
2360 }
2361
2362
2363
2332 // Returns true for a character in a range. Both limits are inclusive. 2364 // Returns true for a character in a range. Both limits are inclusive.
2333 static inline bool Between(uint32_t character, uint32_t from, uint32_t to) { 2365 static inline bool Between(uint32_t character, uint32_t from, uint32_t to) {
2334 // This makes uses of the the unsigned wraparound. 2366 // This makes uses of the the unsigned wraparound.
2335 return character - from <= to - from; 2367 return character - from <= to - from;
2336 } 2368 }
2337 2369
2338 2370
2339 MUST_USE_RESULT static inline MaybeObject* MakeOrFindTwoCharacterString( 2371 MUST_USE_RESULT static inline MaybeObject* MakeOrFindTwoCharacterString(
2340 uint32_t c1, 2372 uint32_t c1,
2341 uint32_t c2) { 2373 uint32_t c2) {
(...skipping 3203 matching lines...) Expand 10 before | Expand all | Expand 10 after
5545 void ExternalStringTable::TearDown() { 5577 void ExternalStringTable::TearDown() {
5546 new_space_strings_.Free(); 5578 new_space_strings_.Free();
5547 old_space_strings_.Free(); 5579 old_space_strings_.Free();
5548 } 5580 }
5549 5581
5550 5582
5551 List<Object*> ExternalStringTable::new_space_strings_; 5583 List<Object*> ExternalStringTable::new_space_strings_;
5552 List<Object*> ExternalStringTable::old_space_strings_; 5584 List<Object*> ExternalStringTable::old_space_strings_;
5553 5585
5554 } } // namespace v8::internal 5586 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698