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

Side by Side Diff: src/heap.cc

Issue 7549008: Preliminary code for block scopes and block contexts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Small fix: set harmony flag properly Created 9 years, 4 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/hydrogen.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 oddball_map()->set_prototype(null_value()); 1738 oddball_map()->set_prototype(null_value());
1739 oddball_map()->set_constructor(null_value()); 1739 oddball_map()->set_constructor(null_value());
1740 1740
1741 { MaybeObject* maybe_obj = 1741 { MaybeObject* maybe_obj =
1742 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 1742 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
1743 if (!maybe_obj->ToObject(&obj)) return false; 1743 if (!maybe_obj->ToObject(&obj)) return false;
1744 } 1744 }
1745 set_fixed_cow_array_map(Map::cast(obj)); 1745 set_fixed_cow_array_map(Map::cast(obj));
1746 ASSERT(fixed_array_map() != fixed_cow_array_map()); 1746 ASSERT(fixed_array_map() != fixed_cow_array_map());
1747 1747
1748 { MaybeObject* maybe_obj =
1749 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
1750 if (!maybe_obj->ToObject(&obj)) return false;
1751 }
1752 set_serialized_scope_info_map(Map::cast(obj));
1753
1748 { MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); 1754 { MaybeObject* maybe_obj = AllocateMap(HEAP_NUMBER_TYPE, HeapNumber::kSize);
1749 if (!maybe_obj->ToObject(&obj)) return false; 1755 if (!maybe_obj->ToObject(&obj)) return false;
1750 } 1756 }
1751 set_heap_number_map(Map::cast(obj)); 1757 set_heap_number_map(Map::cast(obj));
1752 1758
1753 { MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize); 1759 { MaybeObject* maybe_obj = AllocateMap(FOREIGN_TYPE, Foreign::kSize);
1754 if (!maybe_obj->ToObject(&obj)) return false; 1760 if (!maybe_obj->ToObject(&obj)) return false;
1755 } 1761 }
1756 set_foreign_map(Map::cast(obj)); 1762 set_foreign_map(Map::cast(obj));
1757 1763
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 { MaybeObject* maybe_obj = 1909 { MaybeObject* maybe_obj =
1904 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 1910 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
1905 if (!maybe_obj->ToObject(&obj)) return false; 1911 if (!maybe_obj->ToObject(&obj)) return false;
1906 } 1912 }
1907 set_with_context_map(Map::cast(obj)); 1913 set_with_context_map(Map::cast(obj));
1908 1914
1909 { MaybeObject* maybe_obj = 1915 { MaybeObject* maybe_obj =
1910 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 1916 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
1911 if (!maybe_obj->ToObject(&obj)) return false; 1917 if (!maybe_obj->ToObject(&obj)) return false;
1912 } 1918 }
1919 set_block_context_map(Map::cast(obj));
1920
1921 { MaybeObject* maybe_obj =
1922 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
1923 if (!maybe_obj->ToObject(&obj)) return false;
1924 }
1913 Map* global_context_map = Map::cast(obj); 1925 Map* global_context_map = Map::cast(obj);
1914 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext); 1926 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext);
1915 set_global_context_map(global_context_map); 1927 set_global_context_map(global_context_map);
1916 1928
1917 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, 1929 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE,
1918 SharedFunctionInfo::kAlignedSize); 1930 SharedFunctionInfo::kAlignedSize);
1919 if (!maybe_obj->ToObject(&obj)) return false; 1931 if (!maybe_obj->ToObject(&obj)) return false;
1920 } 1932 }
1921 set_shared_function_info_map(Map::cast(obj)); 1933 set_shared_function_info_map(Map::cast(obj));
1922 1934
(...skipping 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after
4010 Context* context = reinterpret_cast<Context*>(result); 4022 Context* context = reinterpret_cast<Context*>(result);
4011 context->set_map(with_context_map()); 4023 context->set_map(with_context_map());
4012 context->set_closure(function); 4024 context->set_closure(function);
4013 context->set_previous(previous); 4025 context->set_previous(previous);
4014 context->set_extension(extension); 4026 context->set_extension(extension);
4015 context->set_global(previous->global()); 4027 context->set_global(previous->global());
4016 return context; 4028 return context;
4017 } 4029 }
4018 4030
4019 4031
4032 MaybeObject* Heap::AllocateBlockContext(JSFunction* function,
4033 Context* previous,
4034 SerializedScopeInfo* scope_info) {
4035 Object* result;
4036 { MaybeObject* maybe_result =
4037 AllocateFixedArray(scope_info->NumberOfContextSlots());
4038 if (!maybe_result->ToObject(&result)) return maybe_result;
4039 }
4040 // TODO(keuchel): properly initialize context slots.
4041 Context* context = reinterpret_cast<Context*>(result);
4042 context->set_map(block_context_map());
4043 context->set_closure(function);
4044 context->set_previous(previous);
4045 context->set_extension(scope_info);
4046 context->set_global(previous->global());
4047 return context;
4048 }
4049
4050
4051 MaybeObject* Heap::AllocateSerializedScopeInfo(int length) {
4052 Object* result;
4053 { MaybeObject* maybe_result = AllocateFixedArray(length, TENURED);
4054 if (!maybe_result->ToObject(&result)) return maybe_result;
4055 }
4056 SerializedScopeInfo* scope_info =
4057 reinterpret_cast<SerializedScopeInfo*>(result);
4058 scope_info->set_map(serialized_scope_info_map());
4059 return scope_info;
4060 }
4061
4062
4020 MaybeObject* Heap::AllocateStruct(InstanceType type) { 4063 MaybeObject* Heap::AllocateStruct(InstanceType type) {
4021 Map* map; 4064 Map* map;
4022 switch (type) { 4065 switch (type) {
4023 #define MAKE_CASE(NAME, Name, name) \ 4066 #define MAKE_CASE(NAME, Name, name) \
4024 case NAME##_TYPE: map = name##_map(); break; 4067 case NAME##_TYPE: map = name##_map(); break;
4025 STRUCT_LIST(MAKE_CASE) 4068 STRUCT_LIST(MAKE_CASE)
4026 #undef MAKE_CASE 4069 #undef MAKE_CASE
4027 default: 4070 default:
4028 UNREACHABLE(); 4071 UNREACHABLE();
4029 return Failure::InternalError(); 4072 return Failure::InternalError();
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
6053 } 6096 }
6054 6097
6055 6098
6056 void ExternalStringTable::TearDown() { 6099 void ExternalStringTable::TearDown() {
6057 new_space_strings_.Free(); 6100 new_space_strings_.Free();
6058 old_space_strings_.Free(); 6101 old_space_strings_.Free();
6059 } 6102 }
6060 6103
6061 6104
6062 } } // namespace v8::internal 6105 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698