OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 #include "macro-assembler.h" | 34 #include "macro-assembler.h" |
35 #include "objects.h" | 35 #include "objects.h" |
36 #include "objects-visiting.h" | 36 #include "objects-visiting.h" |
37 | 37 |
38 namespace v8 { | 38 namespace v8 { |
39 namespace internal { | 39 namespace internal { |
40 | 40 |
41 | 41 |
42 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { | 42 Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { |
43 ASSERT(0 <= size); | 43 ASSERT(0 <= size); |
44 CALL_HEAP_FUNCTION(Heap::AllocateFixedArray(size, pretenure), FixedArray); | 44 CALL_HEAP_FUNCTION( |
| 45 isolate(), |
| 46 isolate()->heap()->AllocateFixedArray(size, pretenure), |
| 47 FixedArray); |
45 } | 48 } |
46 | 49 |
47 | 50 |
48 Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size, | 51 Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size, |
49 PretenureFlag pretenure) { | 52 PretenureFlag pretenure) { |
50 ASSERT(0 <= size); | 53 ASSERT(0 <= size); |
51 CALL_HEAP_FUNCTION(Heap::AllocateFixedArrayWithHoles(size, pretenure), | 54 CALL_HEAP_FUNCTION( |
52 FixedArray); | 55 isolate(), |
| 56 isolate()->heap()->AllocateFixedArrayWithHoles(size, pretenure), |
| 57 FixedArray); |
53 } | 58 } |
54 | 59 |
55 | 60 |
56 Handle<StringDictionary> Factory::NewStringDictionary(int at_least_space_for) { | 61 Handle<StringDictionary> Factory::NewStringDictionary(int at_least_space_for) { |
57 ASSERT(0 <= at_least_space_for); | 62 ASSERT(0 <= at_least_space_for); |
58 CALL_HEAP_FUNCTION(StringDictionary::Allocate(at_least_space_for), | 63 CALL_HEAP_FUNCTION(isolate(), |
| 64 StringDictionary::Allocate(at_least_space_for), |
59 StringDictionary); | 65 StringDictionary); |
60 } | 66 } |
61 | 67 |
62 | 68 |
63 Handle<NumberDictionary> Factory::NewNumberDictionary(int at_least_space_for) { | 69 Handle<NumberDictionary> Factory::NewNumberDictionary(int at_least_space_for) { |
64 ASSERT(0 <= at_least_space_for); | 70 ASSERT(0 <= at_least_space_for); |
65 CALL_HEAP_FUNCTION(NumberDictionary::Allocate(at_least_space_for), | 71 CALL_HEAP_FUNCTION(isolate(), |
| 72 NumberDictionary::Allocate(at_least_space_for), |
66 NumberDictionary); | 73 NumberDictionary); |
67 } | 74 } |
68 | 75 |
69 | 76 |
70 Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors) { | 77 Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors) { |
71 ASSERT(0 <= number_of_descriptors); | 78 ASSERT(0 <= number_of_descriptors); |
72 CALL_HEAP_FUNCTION(DescriptorArray::Allocate(number_of_descriptors), | 79 CALL_HEAP_FUNCTION(isolate(), |
| 80 DescriptorArray::Allocate(number_of_descriptors), |
73 DescriptorArray); | 81 DescriptorArray); |
74 } | 82 } |
75 | 83 |
76 | 84 |
77 Handle<DeoptimizationInputData> Factory::NewDeoptimizationInputData( | 85 Handle<DeoptimizationInputData> Factory::NewDeoptimizationInputData( |
78 int deopt_entry_count, | 86 int deopt_entry_count, |
79 PretenureFlag pretenure) { | 87 PretenureFlag pretenure) { |
80 ASSERT(deopt_entry_count > 0); | 88 ASSERT(deopt_entry_count > 0); |
81 CALL_HEAP_FUNCTION(DeoptimizationInputData::Allocate(deopt_entry_count, | 89 CALL_HEAP_FUNCTION(isolate(), |
| 90 DeoptimizationInputData::Allocate(deopt_entry_count, |
82 pretenure), | 91 pretenure), |
83 DeoptimizationInputData); | 92 DeoptimizationInputData); |
84 } | 93 } |
85 | 94 |
86 | 95 |
87 Handle<DeoptimizationOutputData> Factory::NewDeoptimizationOutputData( | 96 Handle<DeoptimizationOutputData> Factory::NewDeoptimizationOutputData( |
88 int deopt_entry_count, | 97 int deopt_entry_count, |
89 PretenureFlag pretenure) { | 98 PretenureFlag pretenure) { |
90 ASSERT(deopt_entry_count > 0); | 99 ASSERT(deopt_entry_count > 0); |
91 CALL_HEAP_FUNCTION(DeoptimizationOutputData::Allocate(deopt_entry_count, | 100 CALL_HEAP_FUNCTION(isolate(), |
| 101 DeoptimizationOutputData::Allocate(deopt_entry_count, |
92 pretenure), | 102 pretenure), |
93 DeoptimizationOutputData); | 103 DeoptimizationOutputData); |
94 } | 104 } |
95 | 105 |
96 | 106 |
97 // Symbols are created in the old generation (data space). | 107 // Symbols are created in the old generation (data space). |
98 Handle<String> Factory::LookupSymbol(Vector<const char> string) { | 108 Handle<String> Factory::LookupSymbol(Vector<const char> string) { |
99 CALL_HEAP_FUNCTION(Heap::LookupSymbol(string), String); | 109 CALL_HEAP_FUNCTION(isolate(), |
| 110 isolate()->heap()->LookupSymbol(string), |
| 111 String); |
100 } | 112 } |
101 | 113 |
102 Handle<String> Factory::LookupAsciiSymbol(Vector<const char> string) { | 114 Handle<String> Factory::LookupAsciiSymbol(Vector<const char> string) { |
103 CALL_HEAP_FUNCTION(Heap::LookupAsciiSymbol(string), String); | 115 CALL_HEAP_FUNCTION(isolate(), |
| 116 isolate()->heap()->LookupAsciiSymbol(string), |
| 117 String); |
104 } | 118 } |
105 | 119 |
106 Handle<String> Factory::LookupTwoByteSymbol(Vector<const uc16> string) { | 120 Handle<String> Factory::LookupTwoByteSymbol(Vector<const uc16> string) { |
107 CALL_HEAP_FUNCTION(Heap::LookupTwoByteSymbol(string), String); | 121 CALL_HEAP_FUNCTION(isolate(), |
| 122 isolate()->heap()->LookupTwoByteSymbol(string), |
| 123 String); |
108 } | 124 } |
109 | 125 |
110 | 126 |
111 Handle<String> Factory::NewStringFromAscii(Vector<const char> string, | 127 Handle<String> Factory::NewStringFromAscii(Vector<const char> string, |
112 PretenureFlag pretenure) { | 128 PretenureFlag pretenure) { |
113 CALL_HEAP_FUNCTION(Heap::AllocateStringFromAscii(string, pretenure), String); | 129 CALL_HEAP_FUNCTION( |
| 130 isolate(), |
| 131 isolate()->heap()->AllocateStringFromAscii(string, pretenure), |
| 132 String); |
114 } | 133 } |
115 | 134 |
116 Handle<String> Factory::NewStringFromUtf8(Vector<const char> string, | 135 Handle<String> Factory::NewStringFromUtf8(Vector<const char> string, |
117 PretenureFlag pretenure) { | 136 PretenureFlag pretenure) { |
118 CALL_HEAP_FUNCTION(Heap::AllocateStringFromUtf8(string, pretenure), String); | 137 CALL_HEAP_FUNCTION( |
| 138 isolate(), |
| 139 isolate()->heap()->AllocateStringFromUtf8(string, pretenure), |
| 140 String); |
119 } | 141 } |
120 | 142 |
121 | 143 |
122 Handle<String> Factory::NewStringFromTwoByte(Vector<const uc16> string, | 144 Handle<String> Factory::NewStringFromTwoByte(Vector<const uc16> string, |
123 PretenureFlag pretenure) { | 145 PretenureFlag pretenure) { |
124 CALL_HEAP_FUNCTION(Heap::AllocateStringFromTwoByte(string, pretenure), | 146 CALL_HEAP_FUNCTION( |
125 String); | 147 isolate(), |
| 148 isolate()->heap()->AllocateStringFromTwoByte(string, pretenure), |
| 149 String); |
126 } | 150 } |
127 | 151 |
128 | 152 |
129 Handle<String> Factory::NewRawAsciiString(int length, | 153 Handle<String> Factory::NewRawAsciiString(int length, |
130 PretenureFlag pretenure) { | 154 PretenureFlag pretenure) { |
131 CALL_HEAP_FUNCTION(Heap::AllocateRawAsciiString(length, pretenure), String); | 155 CALL_HEAP_FUNCTION( |
| 156 isolate(), |
| 157 isolate()->heap()->AllocateRawAsciiString(length, pretenure), |
| 158 String); |
132 } | 159 } |
133 | 160 |
134 | 161 |
135 Handle<String> Factory::NewRawTwoByteString(int length, | 162 Handle<String> Factory::NewRawTwoByteString(int length, |
136 PretenureFlag pretenure) { | 163 PretenureFlag pretenure) { |
137 CALL_HEAP_FUNCTION(Heap::AllocateRawTwoByteString(length, pretenure), String); | 164 CALL_HEAP_FUNCTION( |
| 165 isolate(), |
| 166 isolate()->heap()->AllocateRawTwoByteString(length, pretenure), |
| 167 String); |
138 } | 168 } |
139 | 169 |
140 | 170 |
141 Handle<String> Factory::NewConsString(Handle<String> first, | 171 Handle<String> Factory::NewConsString(Handle<String> first, |
142 Handle<String> second) { | 172 Handle<String> second) { |
143 CALL_HEAP_FUNCTION(Heap::AllocateConsString(*first, *second), String); | 173 CALL_HEAP_FUNCTION(isolate(), |
| 174 isolate()->heap()->AllocateConsString(*first, *second), |
| 175 String); |
144 } | 176 } |
145 | 177 |
146 | 178 |
147 Handle<String> Factory::NewSubString(Handle<String> str, | 179 Handle<String> Factory::NewSubString(Handle<String> str, |
148 int begin, | 180 int begin, |
149 int end) { | 181 int end) { |
150 CALL_HEAP_FUNCTION(str->SubString(begin, end), String); | 182 CALL_HEAP_FUNCTION(isolate(), |
| 183 str->SubString(begin, end), |
| 184 String); |
151 } | 185 } |
152 | 186 |
153 | 187 |
154 Handle<String> Factory::NewExternalStringFromAscii( | 188 Handle<String> Factory::NewExternalStringFromAscii( |
155 ExternalAsciiString::Resource* resource) { | 189 ExternalAsciiString::Resource* resource) { |
156 CALL_HEAP_FUNCTION(Heap::AllocateExternalStringFromAscii(resource), String); | 190 CALL_HEAP_FUNCTION( |
| 191 isolate(), |
| 192 isolate()->heap()->AllocateExternalStringFromAscii(resource), |
| 193 String); |
157 } | 194 } |
158 | 195 |
159 | 196 |
160 Handle<String> Factory::NewExternalStringFromTwoByte( | 197 Handle<String> Factory::NewExternalStringFromTwoByte( |
161 ExternalTwoByteString::Resource* resource) { | 198 ExternalTwoByteString::Resource* resource) { |
162 CALL_HEAP_FUNCTION(Heap::AllocateExternalStringFromTwoByte(resource), String); | 199 CALL_HEAP_FUNCTION( |
| 200 isolate(), |
| 201 isolate()->heap()->AllocateExternalStringFromTwoByte(resource), |
| 202 String); |
163 } | 203 } |
164 | 204 |
165 | 205 |
166 Handle<Context> Factory::NewGlobalContext() { | 206 Handle<Context> Factory::NewGlobalContext() { |
167 CALL_HEAP_FUNCTION(Heap::AllocateGlobalContext(), Context); | 207 CALL_HEAP_FUNCTION( |
| 208 isolate(), |
| 209 isolate()->heap()->AllocateGlobalContext(), |
| 210 Context); |
168 } | 211 } |
169 | 212 |
170 | 213 |
171 Handle<Context> Factory::NewFunctionContext(int length, | 214 Handle<Context> Factory::NewFunctionContext(int length, |
172 Handle<JSFunction> closure) { | 215 Handle<JSFunction> closure) { |
173 CALL_HEAP_FUNCTION(Heap::AllocateFunctionContext(length, *closure), Context); | 216 CALL_HEAP_FUNCTION( |
| 217 isolate(), |
| 218 isolate()->heap()->AllocateFunctionContext(length, *closure), |
| 219 Context); |
174 } | 220 } |
175 | 221 |
176 | 222 |
177 Handle<Context> Factory::NewWithContext(Handle<Context> previous, | 223 Handle<Context> Factory::NewWithContext(Handle<Context> previous, |
178 Handle<JSObject> extension, | 224 Handle<JSObject> extension, |
179 bool is_catch_context) { | 225 bool is_catch_context) { |
180 CALL_HEAP_FUNCTION(Heap::AllocateWithContext(*previous, | 226 CALL_HEAP_FUNCTION( |
181 *extension, | 227 isolate(), |
182 is_catch_context), | 228 isolate()->heap()->AllocateWithContext(*previous, |
183 Context); | 229 *extension, |
| 230 is_catch_context), |
| 231 Context); |
184 } | 232 } |
185 | 233 |
186 | 234 |
187 Handle<Struct> Factory::NewStruct(InstanceType type) { | 235 Handle<Struct> Factory::NewStruct(InstanceType type) { |
188 CALL_HEAP_FUNCTION(Heap::AllocateStruct(type), Struct); | 236 CALL_HEAP_FUNCTION( |
| 237 isolate(), |
| 238 isolate()->heap()->AllocateStruct(type), |
| 239 Struct); |
189 } | 240 } |
190 | 241 |
191 | 242 |
192 Handle<AccessorInfo> Factory::NewAccessorInfo() { | 243 Handle<AccessorInfo> Factory::NewAccessorInfo() { |
193 Handle<AccessorInfo> info = | 244 Handle<AccessorInfo> info = |
194 Handle<AccessorInfo>::cast(NewStruct(ACCESSOR_INFO_TYPE)); | 245 Handle<AccessorInfo>::cast(NewStruct(ACCESSOR_INFO_TYPE)); |
195 info->set_flag(0); // Must clear the flag, it was initialized as undefined. | 246 info->set_flag(0); // Must clear the flag, it was initialized as undefined. |
196 return info; | 247 return info; |
197 } | 248 } |
198 | 249 |
199 | 250 |
200 Handle<Script> Factory::NewScript(Handle<String> source) { | 251 Handle<Script> Factory::NewScript(Handle<String> source) { |
201 // Generate id for this script. | 252 // Generate id for this script. |
202 int id; | 253 int id; |
203 if (Heap::last_script_id()->IsUndefined()) { | 254 Heap* heap = isolate()->heap(); |
| 255 if (heap->last_script_id()->IsUndefined()) { |
204 // Script ids start from one. | 256 // Script ids start from one. |
205 id = 1; | 257 id = 1; |
206 } else { | 258 } else { |
207 // Increment id, wrap when positive smi is exhausted. | 259 // Increment id, wrap when positive smi is exhausted. |
208 id = Smi::cast(Heap::last_script_id())->value(); | 260 id = Smi::cast(heap->last_script_id())->value(); |
209 id++; | 261 id++; |
210 if (!Smi::IsValid(id)) { | 262 if (!Smi::IsValid(id)) { |
211 id = 0; | 263 id = 0; |
212 } | 264 } |
213 } | 265 } |
214 Heap::SetLastScriptId(Smi::FromInt(id)); | 266 heap->SetLastScriptId(Smi::FromInt(id)); |
215 | 267 |
216 // Create and initialize script object. | 268 // Create and initialize script object. |
217 Handle<Proxy> wrapper = Factory::NewProxy(0, TENURED); | 269 Handle<Proxy> wrapper = NewProxy(0, TENURED); |
218 Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE)); | 270 Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE)); |
219 script->set_source(*source); | 271 script->set_source(*source); |
220 script->set_name(Heap::undefined_value()); | 272 script->set_name(heap->undefined_value()); |
221 script->set_id(Heap::last_script_id()); | 273 script->set_id(heap->last_script_id()); |
222 script->set_line_offset(Smi::FromInt(0)); | 274 script->set_line_offset(Smi::FromInt(0)); |
223 script->set_column_offset(Smi::FromInt(0)); | 275 script->set_column_offset(Smi::FromInt(0)); |
224 script->set_data(Heap::undefined_value()); | 276 script->set_data(heap->undefined_value()); |
225 script->set_context_data(Heap::undefined_value()); | 277 script->set_context_data(heap->undefined_value()); |
226 script->set_type(Smi::FromInt(Script::TYPE_NORMAL)); | 278 script->set_type(Smi::FromInt(Script::TYPE_NORMAL)); |
227 script->set_compilation_type(Smi::FromInt(Script::COMPILATION_TYPE_HOST)); | 279 script->set_compilation_type(Smi::FromInt(Script::COMPILATION_TYPE_HOST)); |
228 script->set_wrapper(*wrapper); | 280 script->set_wrapper(*wrapper); |
229 script->set_line_ends(Heap::undefined_value()); | 281 script->set_line_ends(heap->undefined_value()); |
230 script->set_eval_from_shared(Heap::undefined_value()); | 282 script->set_eval_from_shared(heap->undefined_value()); |
231 script->set_eval_from_instructions_offset(Smi::FromInt(0)); | 283 script->set_eval_from_instructions_offset(Smi::FromInt(0)); |
232 | 284 |
233 return script; | 285 return script; |
234 } | 286 } |
235 | 287 |
236 | 288 |
237 Handle<Proxy> Factory::NewProxy(Address addr, PretenureFlag pretenure) { | 289 Handle<Proxy> Factory::NewProxy(Address addr, PretenureFlag pretenure) { |
238 CALL_HEAP_FUNCTION(Heap::AllocateProxy(addr, pretenure), Proxy); | 290 CALL_HEAP_FUNCTION(isolate(), |
| 291 isolate()->heap()->AllocateProxy(addr, pretenure), |
| 292 Proxy); |
239 } | 293 } |
240 | 294 |
241 | 295 |
242 Handle<Proxy> Factory::NewProxy(const AccessorDescriptor* desc) { | 296 Handle<Proxy> Factory::NewProxy(const AccessorDescriptor* desc) { |
243 return NewProxy((Address) desc, TENURED); | 297 return NewProxy((Address) desc, TENURED); |
244 } | 298 } |
245 | 299 |
246 | 300 |
247 Handle<ByteArray> Factory::NewByteArray(int length, PretenureFlag pretenure) { | 301 Handle<ByteArray> Factory::NewByteArray(int length, PretenureFlag pretenure) { |
248 ASSERT(0 <= length); | 302 ASSERT(0 <= length); |
249 CALL_HEAP_FUNCTION(Heap::AllocateByteArray(length, pretenure), ByteArray); | 303 CALL_HEAP_FUNCTION( |
| 304 isolate(), |
| 305 isolate()->heap()->AllocateByteArray(length, pretenure), |
| 306 ByteArray); |
250 } | 307 } |
251 | 308 |
252 | 309 |
253 Handle<ExternalArray> Factory::NewExternalArray(int length, | 310 Handle<ExternalArray> Factory::NewExternalArray(int length, |
254 ExternalArrayType array_type, | 311 ExternalArrayType array_type, |
255 void* external_pointer, | 312 void* external_pointer, |
256 PretenureFlag pretenure) { | 313 PretenureFlag pretenure) { |
257 ASSERT(0 <= length); | 314 ASSERT(0 <= length); |
258 CALL_HEAP_FUNCTION(Heap::AllocateExternalArray(length, | 315 CALL_HEAP_FUNCTION( |
259 array_type, | 316 isolate(), |
260 external_pointer, | 317 isolate()->heap()->AllocateExternalArray(length, |
261 pretenure), ExternalArray); | 318 array_type, |
| 319 external_pointer, |
| 320 pretenure), |
| 321 ExternalArray); |
262 } | 322 } |
263 | 323 |
264 | 324 |
265 Handle<JSGlobalPropertyCell> Factory::NewJSGlobalPropertyCell( | 325 Handle<JSGlobalPropertyCell> Factory::NewJSGlobalPropertyCell( |
266 Handle<Object> value) { | 326 Handle<Object> value) { |
267 CALL_HEAP_FUNCTION(Heap::AllocateJSGlobalPropertyCell(*value), | 327 CALL_HEAP_FUNCTION( |
268 JSGlobalPropertyCell); | 328 isolate(), |
| 329 isolate()->heap()->AllocateJSGlobalPropertyCell(*value), |
| 330 JSGlobalPropertyCell); |
269 } | 331 } |
270 | 332 |
271 | 333 |
272 Handle<Map> Factory::NewMap(InstanceType type, int instance_size) { | 334 Handle<Map> Factory::NewMap(InstanceType type, int instance_size) { |
273 CALL_HEAP_FUNCTION(Heap::AllocateMap(type, instance_size), Map); | 335 CALL_HEAP_FUNCTION( |
| 336 isolate(), |
| 337 isolate()->heap()->AllocateMap(type, instance_size), |
| 338 Map); |
274 } | 339 } |
275 | 340 |
276 | 341 |
277 Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { | 342 Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { |
278 CALL_HEAP_FUNCTION(Heap::AllocateFunctionPrototype(*function), JSObject); | 343 CALL_HEAP_FUNCTION( |
| 344 isolate(), |
| 345 isolate()->heap()->AllocateFunctionPrototype(*function), |
| 346 JSObject); |
279 } | 347 } |
280 | 348 |
281 | 349 |
282 Handle<Map> Factory::CopyMapDropDescriptors(Handle<Map> src) { | 350 Handle<Map> Factory::CopyMapDropDescriptors(Handle<Map> src) { |
283 CALL_HEAP_FUNCTION(src->CopyDropDescriptors(), Map); | 351 CALL_HEAP_FUNCTION(isolate(), src->CopyDropDescriptors(), Map); |
284 } | 352 } |
285 | 353 |
286 | 354 |
287 Handle<Map> Factory::CopyMap(Handle<Map> src, | 355 Handle<Map> Factory::CopyMap(Handle<Map> src, |
288 int extra_inobject_properties) { | 356 int extra_inobject_properties) { |
289 Handle<Map> copy = CopyMapDropDescriptors(src); | 357 Handle<Map> copy = CopyMapDropDescriptors(src); |
290 // Check that we do not overflow the instance size when adding the | 358 // Check that we do not overflow the instance size when adding the |
291 // extra inobject properties. | 359 // extra inobject properties. |
292 int instance_size_delta = extra_inobject_properties * kPointerSize; | 360 int instance_size_delta = extra_inobject_properties * kPointerSize; |
293 int max_instance_size_delta = | 361 int max_instance_size_delta = |
294 JSObject::kMaxInstanceSize - copy->instance_size(); | 362 JSObject::kMaxInstanceSize - copy->instance_size(); |
295 if (instance_size_delta > max_instance_size_delta) { | 363 if (instance_size_delta > max_instance_size_delta) { |
296 // If the instance size overflows, we allocate as many properties | 364 // If the instance size overflows, we allocate as many properties |
297 // as we can as inobject properties. | 365 // as we can as inobject properties. |
298 instance_size_delta = max_instance_size_delta; | 366 instance_size_delta = max_instance_size_delta; |
299 extra_inobject_properties = max_instance_size_delta >> kPointerSizeLog2; | 367 extra_inobject_properties = max_instance_size_delta >> kPointerSizeLog2; |
300 } | 368 } |
301 // Adjust the map with the extra inobject properties. | 369 // Adjust the map with the extra inobject properties. |
302 int inobject_properties = | 370 int inobject_properties = |
303 copy->inobject_properties() + extra_inobject_properties; | 371 copy->inobject_properties() + extra_inobject_properties; |
304 copy->set_inobject_properties(inobject_properties); | 372 copy->set_inobject_properties(inobject_properties); |
305 copy->set_unused_property_fields(inobject_properties); | 373 copy->set_unused_property_fields(inobject_properties); |
306 copy->set_instance_size(copy->instance_size() + instance_size_delta); | 374 copy->set_instance_size(copy->instance_size() + instance_size_delta); |
307 copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy)); | 375 copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy)); |
308 return copy; | 376 return copy; |
309 } | 377 } |
310 | 378 |
311 | 379 |
312 Handle<Map> Factory::CopyMapDropTransitions(Handle<Map> src) { | 380 Handle<Map> Factory::CopyMapDropTransitions(Handle<Map> src) { |
313 CALL_HEAP_FUNCTION(src->CopyDropTransitions(), Map); | 381 CALL_HEAP_FUNCTION(isolate(), src->CopyDropTransitions(), Map); |
314 } | 382 } |
315 | 383 |
316 | 384 |
317 Handle<Map> Factory::GetFastElementsMap(Handle<Map> src) { | 385 Handle<Map> Factory::GetFastElementsMap(Handle<Map> src) { |
318 CALL_HEAP_FUNCTION(src->GetFastElementsMap(), Map); | 386 CALL_HEAP_FUNCTION(isolate(), src->GetFastElementsMap(), Map); |
319 } | 387 } |
320 | 388 |
321 | 389 |
322 Handle<Map> Factory::GetSlowElementsMap(Handle<Map> src) { | 390 Handle<Map> Factory::GetSlowElementsMap(Handle<Map> src) { |
323 CALL_HEAP_FUNCTION(src->GetSlowElementsMap(), Map); | 391 CALL_HEAP_FUNCTION(isolate(), src->GetSlowElementsMap(), Map); |
324 } | 392 } |
325 | 393 |
326 | 394 |
327 Handle<Map> Factory::NewExternalArrayElementsMap(Handle<Map> src) { | 395 Handle<Map> Factory::NewExternalArrayElementsMap(Handle<Map> src) { |
328 CALL_HEAP_FUNCTION(src->NewExternalArrayElementsMap(), Map); | 396 CALL_HEAP_FUNCTION(isolate(), src->NewExternalArrayElementsMap(), Map); |
329 } | 397 } |
330 | 398 |
331 | 399 |
332 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { | 400 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { |
333 CALL_HEAP_FUNCTION(array->Copy(), FixedArray); | 401 CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray); |
334 } | 402 } |
335 | 403 |
336 | 404 |
337 Handle<JSFunction> Factory::BaseNewFunctionFromSharedFunctionInfo( | 405 Handle<JSFunction> Factory::BaseNewFunctionFromSharedFunctionInfo( |
338 Handle<SharedFunctionInfo> function_info, | 406 Handle<SharedFunctionInfo> function_info, |
339 Handle<Map> function_map, | 407 Handle<Map> function_map, |
340 PretenureFlag pretenure) { | 408 PretenureFlag pretenure) { |
341 CALL_HEAP_FUNCTION(Heap::AllocateFunction(*function_map, | 409 CALL_HEAP_FUNCTION( |
342 *function_info, | 410 isolate(), |
343 Heap::the_hole_value(), | 411 isolate()->heap()->AllocateFunction(*function_map, |
344 pretenure), | 412 *function_info, |
| 413 isolate()->heap()->the_hole_value(), |
| 414 pretenure), |
345 JSFunction); | 415 JSFunction); |
346 } | 416 } |
347 | 417 |
348 | 418 |
349 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( | 419 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
350 Handle<SharedFunctionInfo> function_info, | 420 Handle<SharedFunctionInfo> function_info, |
351 Handle<Context> context, | 421 Handle<Context> context, |
352 PretenureFlag pretenure) { | 422 PretenureFlag pretenure) { |
353 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( | 423 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( |
354 function_info, | 424 function_info, |
355 function_info->strict_mode() | 425 function_info->strict_mode() |
356 ? Top::strict_mode_function_map() | 426 ? isolate()->strict_mode_function_map() |
357 : Top::function_map(), | 427 : isolate()->function_map(), |
358 pretenure); | 428 pretenure); |
359 | 429 |
360 result->set_context(*context); | 430 result->set_context(*context); |
361 int number_of_literals = function_info->num_literals(); | 431 int number_of_literals = function_info->num_literals(); |
362 Handle<FixedArray> literals = | 432 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); |
363 Factory::NewFixedArray(number_of_literals, pretenure); | |
364 if (number_of_literals > 0) { | 433 if (number_of_literals > 0) { |
365 // Store the object, regexp and array functions in the literals | 434 // Store the object, regexp and array functions in the literals |
366 // array prefix. These functions will be used when creating | 435 // array prefix. These functions will be used when creating |
367 // object, regexp and array literals in this function. | 436 // object, regexp and array literals in this function. |
368 literals->set(JSFunction::kLiteralGlobalContextIndex, | 437 literals->set(JSFunction::kLiteralGlobalContextIndex, |
369 context->global_context()); | 438 context->global_context()); |
370 } | 439 } |
371 result->set_literals(*literals); | 440 result->set_literals(*literals); |
372 result->set_next_function_link(Heap::undefined_value()); | 441 result->set_next_function_link(isolate()->heap()->undefined_value()); |
373 | 442 |
374 if (V8::UseCrankshaft() && | 443 if (V8::UseCrankshaft() && |
375 FLAG_always_opt && | 444 FLAG_always_opt && |
376 result->is_compiled() && | 445 result->is_compiled() && |
377 !function_info->is_toplevel() && | 446 !function_info->is_toplevel() && |
378 function_info->allows_lazy_compilation()) { | 447 function_info->allows_lazy_compilation()) { |
379 result->MarkForLazyRecompilation(); | 448 result->MarkForLazyRecompilation(); |
380 } | 449 } |
381 return result; | 450 return result; |
382 } | 451 } |
383 | 452 |
384 | 453 |
385 Handle<Object> Factory::NewNumber(double value, | 454 Handle<Object> Factory::NewNumber(double value, |
386 PretenureFlag pretenure) { | 455 PretenureFlag pretenure) { |
387 CALL_HEAP_FUNCTION(Heap::NumberFromDouble(value, pretenure), Object); | 456 CALL_HEAP_FUNCTION( |
| 457 isolate(), |
| 458 isolate()->heap()->NumberFromDouble(value, pretenure), Object); |
388 } | 459 } |
389 | 460 |
390 | 461 |
391 Handle<Object> Factory::NewNumberFromInt(int value) { | 462 Handle<Object> Factory::NewNumberFromInt(int value) { |
392 CALL_HEAP_FUNCTION(Heap::NumberFromInt32(value), Object); | 463 CALL_HEAP_FUNCTION( |
| 464 isolate(), |
| 465 isolate()->heap()->NumberFromInt32(value), Object); |
393 } | 466 } |
394 | 467 |
395 | 468 |
396 Handle<Object> Factory::NewNumberFromUint(uint32_t value) { | 469 Handle<Object> Factory::NewNumberFromUint(uint32_t value) { |
397 CALL_HEAP_FUNCTION(Heap::NumberFromUint32(value), Object); | 470 CALL_HEAP_FUNCTION( |
| 471 isolate(), |
| 472 isolate()->heap()->NumberFromUint32(value), Object); |
398 } | 473 } |
399 | 474 |
400 | 475 |
401 Handle<JSObject> Factory::NewNeanderObject() { | 476 Handle<JSObject> Factory::NewNeanderObject() { |
402 CALL_HEAP_FUNCTION(Heap::AllocateJSObjectFromMap(Heap::neander_map()), | 477 CALL_HEAP_FUNCTION( |
403 JSObject); | 478 isolate(), |
| 479 isolate()->heap()->AllocateJSObjectFromMap( |
| 480 isolate()->heap()->neander_map()), |
| 481 JSObject); |
404 } | 482 } |
405 | 483 |
406 | 484 |
407 Handle<Object> Factory::NewTypeError(const char* type, | 485 Handle<Object> Factory::NewTypeError(const char* type, |
408 Vector< Handle<Object> > args) { | 486 Vector< Handle<Object> > args) { |
409 return NewError("MakeTypeError", type, args); | 487 return NewError("MakeTypeError", type, args); |
410 } | 488 } |
411 | 489 |
412 | 490 |
413 Handle<Object> Factory::NewTypeError(Handle<String> message) { | 491 Handle<Object> Factory::NewTypeError(Handle<String> message) { |
(...skipping 29 matching lines...) Expand all Loading... |
443 | 521 |
444 | 522 |
445 Handle<Object> Factory::NewReferenceError(Handle<String> message) { | 523 Handle<Object> Factory::NewReferenceError(Handle<String> message) { |
446 return NewError("$ReferenceError", message); | 524 return NewError("$ReferenceError", message); |
447 } | 525 } |
448 | 526 |
449 | 527 |
450 Handle<Object> Factory::NewError(const char* maker, const char* type, | 528 Handle<Object> Factory::NewError(const char* maker, const char* type, |
451 Vector< Handle<Object> > args) { | 529 Vector< Handle<Object> > args) { |
452 v8::HandleScope scope; // Instantiate a closeable HandleScope for EscapeFrom. | 530 v8::HandleScope scope; // Instantiate a closeable HandleScope for EscapeFrom. |
453 Handle<FixedArray> array = Factory::NewFixedArray(args.length()); | 531 Handle<FixedArray> array = NewFixedArray(args.length()); |
454 for (int i = 0; i < args.length(); i++) { | 532 for (int i = 0; i < args.length(); i++) { |
455 array->set(i, *args[i]); | 533 array->set(i, *args[i]); |
456 } | 534 } |
457 Handle<JSArray> object = Factory::NewJSArrayWithElements(array); | 535 Handle<JSArray> object = NewJSArrayWithElements(array); |
458 Handle<Object> result = NewError(maker, type, object); | 536 Handle<Object> result = NewError(maker, type, object); |
459 return result.EscapeFrom(&scope); | 537 return result.EscapeFrom(&scope); |
460 } | 538 } |
461 | 539 |
462 | 540 |
463 Handle<Object> Factory::NewEvalError(const char* type, | 541 Handle<Object> Factory::NewEvalError(const char* type, |
464 Vector< Handle<Object> > args) { | 542 Vector< Handle<Object> > args) { |
465 return NewError("MakeEvalError", type, args); | 543 return NewError("MakeEvalError", type, args); |
466 } | 544 } |
467 | 545 |
468 | 546 |
469 Handle<Object> Factory::NewError(const char* type, | 547 Handle<Object> Factory::NewError(const char* type, |
470 Vector< Handle<Object> > args) { | 548 Vector< Handle<Object> > args) { |
471 return NewError("MakeError", type, args); | 549 return NewError("MakeError", type, args); |
472 } | 550 } |
473 | 551 |
474 | 552 |
475 Handle<Object> Factory::NewError(const char* maker, | 553 Handle<Object> Factory::NewError(const char* maker, |
476 const char* type, | 554 const char* type, |
477 Handle<JSArray> args) { | 555 Handle<JSArray> args) { |
478 Handle<String> make_str = Factory::LookupAsciiSymbol(maker); | 556 Handle<String> make_str = LookupAsciiSymbol(maker); |
479 Handle<Object> fun_obj(Top::builtins()->GetPropertyNoExceptionThrown( | 557 Handle<Object> fun_obj( |
480 *make_str)); | 558 isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str)); |
481 // If the builtins haven't been properly configured yet this error | 559 // If the builtins haven't been properly configured yet this error |
482 // constructor may not have been defined. Bail out. | 560 // constructor may not have been defined. Bail out. |
483 if (!fun_obj->IsJSFunction()) | 561 if (!fun_obj->IsJSFunction()) |
484 return Factory::undefined_value(); | 562 return undefined_value(); |
485 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); | 563 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); |
486 Handle<Object> type_obj = Factory::LookupAsciiSymbol(type); | 564 Handle<Object> type_obj = LookupAsciiSymbol(type); |
487 Object** argv[2] = { type_obj.location(), | 565 Object** argv[2] = { type_obj.location(), |
488 Handle<Object>::cast(args).location() }; | 566 Handle<Object>::cast(args).location() }; |
489 | 567 |
490 // Invoke the JavaScript factory method. If an exception is thrown while | 568 // Invoke the JavaScript factory method. If an exception is thrown while |
491 // running the factory method, use the exception as the result. | 569 // running the factory method, use the exception as the result. |
492 bool caught_exception; | 570 bool caught_exception; |
493 Handle<Object> result = Execution::TryCall(fun, | 571 Handle<Object> result = Execution::TryCall(fun, |
494 Top::builtins(), | 572 isolate()->js_builtins_object(), 2, argv, &caught_exception); |
495 2, | |
496 argv, | |
497 &caught_exception); | |
498 return result; | 573 return result; |
499 } | 574 } |
500 | 575 |
501 | 576 |
502 Handle<Object> Factory::NewError(Handle<String> message) { | 577 Handle<Object> Factory::NewError(Handle<String> message) { |
503 return NewError("$Error", message); | 578 return NewError("$Error", message); |
504 } | 579 } |
505 | 580 |
506 | 581 |
507 Handle<Object> Factory::NewError(const char* constructor, | 582 Handle<Object> Factory::NewError(const char* constructor, |
508 Handle<String> message) { | 583 Handle<String> message) { |
509 Handle<String> constr = Factory::LookupAsciiSymbol(constructor); | 584 Handle<String> constr = LookupAsciiSymbol(constructor); |
510 Handle<JSFunction> fun = | 585 Handle<JSFunction> fun = Handle<JSFunction>( |
511 Handle<JSFunction>( | 586 JSFunction::cast(isolate()->js_builtins_object()-> |
512 JSFunction::cast( | 587 GetPropertyNoExceptionThrown(*constr))); |
513 Top::builtins()->GetPropertyNoExceptionThrown(*constr))); | |
514 Object** argv[1] = { Handle<Object>::cast(message).location() }; | 588 Object** argv[1] = { Handle<Object>::cast(message).location() }; |
515 | 589 |
516 // Invoke the JavaScript factory method. If an exception is thrown while | 590 // Invoke the JavaScript factory method. If an exception is thrown while |
517 // running the factory method, use the exception as the result. | 591 // running the factory method, use the exception as the result. |
518 bool caught_exception; | 592 bool caught_exception; |
519 Handle<Object> result = Execution::TryCall(fun, | 593 Handle<Object> result = Execution::TryCall(fun, |
520 Top::builtins(), | 594 isolate()->js_builtins_object(), 1, argv, &caught_exception); |
521 1, | |
522 argv, | |
523 &caught_exception); | |
524 return result; | 595 return result; |
525 } | 596 } |
526 | 597 |
527 | 598 |
528 Handle<JSFunction> Factory::NewFunction(Handle<String> name, | 599 Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
529 InstanceType type, | 600 InstanceType type, |
530 int instance_size, | 601 int instance_size, |
531 Handle<Code> code, | 602 Handle<Code> code, |
532 bool force_initial_map) { | 603 bool force_initial_map) { |
533 // Allocate the function | 604 // Allocate the function |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 instance_size != JSObject::kHeaderSize) { | 645 instance_size != JSObject::kHeaderSize) { |
575 Handle<Map> initial_map = NewMap(type, instance_size); | 646 Handle<Map> initial_map = NewMap(type, instance_size); |
576 function->set_initial_map(*initial_map); | 647 function->set_initial_map(*initial_map); |
577 initial_map->set_constructor(*function); | 648 initial_map->set_constructor(*function); |
578 } | 649 } |
579 | 650 |
580 // Set function.prototype and give the prototype a constructor | 651 // Set function.prototype and give the prototype a constructor |
581 // property that refers to the function. | 652 // property that refers to the function. |
582 SetPrototypeProperty(function, prototype); | 653 SetPrototypeProperty(function, prototype); |
583 // Currently safe because it is only invoked from Genesis. | 654 // Currently safe because it is only invoked from Genesis. |
584 SetLocalPropertyNoThrow( | 655 SetLocalPropertyNoThrow(prototype, constructor_symbol(), function, DONT_ENUM); |
585 prototype, Factory::constructor_symbol(), function, DONT_ENUM); | |
586 return function; | 656 return function; |
587 } | 657 } |
588 | 658 |
589 | 659 |
590 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, | 660 Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, |
591 Handle<Code> code) { | 661 Handle<Code> code) { |
592 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, | 662 Handle<JSFunction> function = NewFunctionWithoutPrototype(name, |
593 kNonStrictMode); | 663 kNonStrictMode); |
594 function->shared()->set_code(*code); | 664 function->shared()->set_code(*code); |
595 function->set_code(*code); | 665 function->set_code(*code); |
596 ASSERT(!function->has_initial_map()); | 666 ASSERT(!function->has_initial_map()); |
597 ASSERT(!function->has_prototype()); | 667 ASSERT(!function->has_prototype()); |
598 return function; | 668 return function; |
599 } | 669 } |
600 | 670 |
601 | 671 |
602 Handle<Code> Factory::NewCode(const CodeDesc& desc, | 672 Handle<Code> Factory::NewCode(const CodeDesc& desc, |
603 Code::Flags flags, | 673 Code::Flags flags, |
604 Handle<Object> self_ref, | 674 Handle<Object> self_ref, |
605 bool immovable) { | 675 bool immovable) { |
606 CALL_HEAP_FUNCTION(Heap::CreateCode(desc, flags, self_ref, immovable), Code); | 676 CALL_HEAP_FUNCTION(isolate(), |
| 677 isolate()->heap()->CreateCode( |
| 678 desc, flags, self_ref, immovable), |
| 679 Code); |
607 } | 680 } |
608 | 681 |
609 | 682 |
610 Handle<Code> Factory::CopyCode(Handle<Code> code) { | 683 Handle<Code> Factory::CopyCode(Handle<Code> code) { |
611 CALL_HEAP_FUNCTION(Heap::CopyCode(*code), Code); | 684 CALL_HEAP_FUNCTION(isolate(), |
| 685 isolate()->heap()->CopyCode(*code), |
| 686 Code); |
612 } | 687 } |
613 | 688 |
614 | 689 |
615 Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { | 690 Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { |
616 CALL_HEAP_FUNCTION(Heap::CopyCode(*code, reloc_info), Code); | 691 CALL_HEAP_FUNCTION(isolate(), |
| 692 isolate()->heap()->CopyCode(*code, reloc_info), |
| 693 Code); |
617 } | 694 } |
618 | 695 |
619 | 696 |
620 MUST_USE_RESULT static inline MaybeObject* DoCopyInsert( | 697 MUST_USE_RESULT static inline MaybeObject* DoCopyInsert( |
621 DescriptorArray* array, | 698 DescriptorArray* array, |
622 String* key, | 699 String* key, |
623 Object* value, | 700 Object* value, |
624 PropertyAttributes attributes) { | 701 PropertyAttributes attributes) { |
625 CallbacksDescriptor desc(key, value, attributes); | 702 CallbacksDescriptor desc(key, value, attributes); |
626 MaybeObject* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS); | 703 MaybeObject* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS); |
627 return obj; | 704 return obj; |
628 } | 705 } |
629 | 706 |
630 | 707 |
631 // Allocate the new array. | 708 // Allocate the new array. |
632 Handle<DescriptorArray> Factory::CopyAppendProxyDescriptor( | 709 Handle<DescriptorArray> Factory::CopyAppendProxyDescriptor( |
633 Handle<DescriptorArray> array, | 710 Handle<DescriptorArray> array, |
634 Handle<String> key, | 711 Handle<String> key, |
635 Handle<Object> value, | 712 Handle<Object> value, |
636 PropertyAttributes attributes) { | 713 PropertyAttributes attributes) { |
637 CALL_HEAP_FUNCTION(DoCopyInsert(*array, *key, *value, attributes), | 714 CALL_HEAP_FUNCTION(isolate(), |
| 715 DoCopyInsert(*array, *key, *value, attributes), |
638 DescriptorArray); | 716 DescriptorArray); |
639 } | 717 } |
640 | 718 |
641 | 719 |
642 Handle<String> Factory::SymbolFromString(Handle<String> value) { | 720 Handle<String> Factory::SymbolFromString(Handle<String> value) { |
643 CALL_HEAP_FUNCTION(Heap::LookupSymbol(*value), String); | 721 CALL_HEAP_FUNCTION(isolate(), |
| 722 isolate()->heap()->LookupSymbol(*value), String); |
644 } | 723 } |
645 | 724 |
646 | 725 |
647 Handle<DescriptorArray> Factory::CopyAppendCallbackDescriptors( | 726 Handle<DescriptorArray> Factory::CopyAppendCallbackDescriptors( |
648 Handle<DescriptorArray> array, | 727 Handle<DescriptorArray> array, |
649 Handle<Object> descriptors) { | 728 Handle<Object> descriptors) { |
650 v8::NeanderArray callbacks(descriptors); | 729 v8::NeanderArray callbacks(descriptors); |
651 int nof_callbacks = callbacks.length(); | 730 int nof_callbacks = callbacks.length(); |
652 Handle<DescriptorArray> result = | 731 Handle<DescriptorArray> result = |
653 NewDescriptorArray(array->number_of_descriptors() + nof_callbacks); | 732 NewDescriptorArray(array->number_of_descriptors() + nof_callbacks); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 } | 777 } |
699 | 778 |
700 // Sort the result before returning. | 779 // Sort the result before returning. |
701 result->Sort(); | 780 result->Sort(); |
702 return result; | 781 return result; |
703 } | 782 } |
704 | 783 |
705 | 784 |
706 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, | 785 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, |
707 PretenureFlag pretenure) { | 786 PretenureFlag pretenure) { |
708 CALL_HEAP_FUNCTION(Heap::AllocateJSObject(*constructor, pretenure), JSObject); | 787 CALL_HEAP_FUNCTION( |
| 788 isolate(), |
| 789 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); |
709 } | 790 } |
710 | 791 |
711 | 792 |
712 Handle<GlobalObject> Factory::NewGlobalObject( | 793 Handle<GlobalObject> Factory::NewGlobalObject( |
713 Handle<JSFunction> constructor) { | 794 Handle<JSFunction> constructor) { |
714 CALL_HEAP_FUNCTION(Heap::AllocateGlobalObject(*constructor), | 795 CALL_HEAP_FUNCTION(isolate(), |
| 796 isolate()->heap()->AllocateGlobalObject(*constructor), |
715 GlobalObject); | 797 GlobalObject); |
716 } | 798 } |
717 | 799 |
718 | 800 |
719 | 801 |
720 Handle<JSObject> Factory::NewJSObjectFromMap(Handle<Map> map) { | 802 Handle<JSObject> Factory::NewJSObjectFromMap(Handle<Map> map) { |
721 CALL_HEAP_FUNCTION(Heap::AllocateJSObjectFromMap(*map, NOT_TENURED), | 803 CALL_HEAP_FUNCTION( |
722 JSObject); | 804 isolate(), |
| 805 isolate()->heap()->AllocateJSObjectFromMap(*map, NOT_TENURED), |
| 806 JSObject); |
723 } | 807 } |
724 | 808 |
725 | 809 |
726 Handle<JSArray> Factory::NewJSArray(int capacity, | 810 Handle<JSArray> Factory::NewJSArray(int capacity, |
727 PretenureFlag pretenure) { | 811 PretenureFlag pretenure) { |
728 Handle<JSObject> obj = NewJSObject(Top::array_function(), pretenure); | 812 Handle<JSObject> obj = NewJSObject(isolate()->array_function(), pretenure); |
729 CALL_HEAP_FUNCTION(Handle<JSArray>::cast(obj)->Initialize(capacity), JSArray); | 813 CALL_HEAP_FUNCTION(isolate(), |
| 814 Handle<JSArray>::cast(obj)->Initialize(capacity), |
| 815 JSArray); |
730 } | 816 } |
731 | 817 |
732 | 818 |
733 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArray> elements, | 819 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArray> elements, |
734 PretenureFlag pretenure) { | 820 PretenureFlag pretenure) { |
735 Handle<JSArray> result = | 821 Handle<JSArray> result = |
736 Handle<JSArray>::cast(NewJSObject(Top::array_function(), pretenure)); | 822 Handle<JSArray>::cast(NewJSObject(isolate()->array_function(), |
| 823 pretenure)); |
737 result->SetContent(*elements); | 824 result->SetContent(*elements); |
738 return result; | 825 return result; |
739 } | 826 } |
740 | 827 |
741 | 828 |
742 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( | 829 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( |
743 Handle<String> name, | 830 Handle<String> name, |
744 int number_of_literals, | 831 int number_of_literals, |
745 Handle<Code> code, | 832 Handle<Code> code, |
746 Handle<SerializedScopeInfo> scope_info) { | 833 Handle<SerializedScopeInfo> scope_info) { |
(...skipping 13 matching lines...) Expand all Loading... |
760 | 847 |
761 | 848 |
762 Handle<JSMessageObject> Factory::NewJSMessageObject( | 849 Handle<JSMessageObject> Factory::NewJSMessageObject( |
763 Handle<String> type, | 850 Handle<String> type, |
764 Handle<JSArray> arguments, | 851 Handle<JSArray> arguments, |
765 int start_position, | 852 int start_position, |
766 int end_position, | 853 int end_position, |
767 Handle<Object> script, | 854 Handle<Object> script, |
768 Handle<Object> stack_trace, | 855 Handle<Object> stack_trace, |
769 Handle<Object> stack_frames) { | 856 Handle<Object> stack_frames) { |
770 CALL_HEAP_FUNCTION(Heap::AllocateJSMessageObject(*type, | 857 CALL_HEAP_FUNCTION(isolate(), |
771 *arguments, | 858 isolate()->heap()->AllocateJSMessageObject(*type, |
772 start_position, | 859 *arguments, |
773 end_position, | 860 start_position, |
774 *script, | 861 end_position, |
775 *stack_trace, | 862 *script, |
776 *stack_frames), | 863 *stack_trace, |
| 864 *stack_frames), |
777 JSMessageObject); | 865 JSMessageObject); |
778 } | 866 } |
779 | 867 |
780 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(Handle<String> name) { | 868 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(Handle<String> name) { |
781 CALL_HEAP_FUNCTION(Heap::AllocateSharedFunctionInfo(*name), | 869 CALL_HEAP_FUNCTION(isolate(), |
| 870 isolate()->heap()->AllocateSharedFunctionInfo(*name), |
782 SharedFunctionInfo); | 871 SharedFunctionInfo); |
783 } | 872 } |
784 | 873 |
785 | 874 |
786 Handle<String> Factory::NumberToString(Handle<Object> number) { | 875 Handle<String> Factory::NumberToString(Handle<Object> number) { |
787 CALL_HEAP_FUNCTION(Heap::NumberToString(*number), String); | 876 CALL_HEAP_FUNCTION(isolate(), |
| 877 isolate()->heap()->NumberToString(*number), String); |
788 } | 878 } |
789 | 879 |
790 | 880 |
791 Handle<NumberDictionary> Factory::DictionaryAtNumberPut( | 881 Handle<NumberDictionary> Factory::DictionaryAtNumberPut( |
792 Handle<NumberDictionary> dictionary, | 882 Handle<NumberDictionary> dictionary, |
793 uint32_t key, | 883 uint32_t key, |
794 Handle<Object> value) { | 884 Handle<Object> value) { |
795 CALL_HEAP_FUNCTION(dictionary->AtNumberPut(key, *value), NumberDictionary); | 885 CALL_HEAP_FUNCTION(isolate(), |
| 886 dictionary->AtNumberPut(key, *value), |
| 887 NumberDictionary); |
796 } | 888 } |
797 | 889 |
798 | 890 |
799 Handle<JSFunction> Factory::NewFunctionHelper(Handle<String> name, | 891 Handle<JSFunction> Factory::NewFunctionHelper(Handle<String> name, |
800 Handle<Object> prototype) { | 892 Handle<Object> prototype) { |
801 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); | 893 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); |
802 CALL_HEAP_FUNCTION(Heap::AllocateFunction(*Top::function_map(), | 894 CALL_HEAP_FUNCTION( |
803 *function_share, | 895 isolate(), |
804 *prototype), | 896 isolate()->heap()->AllocateFunction(*isolate()->function_map(), |
805 JSFunction); | 897 *function_share, |
| 898 *prototype), |
| 899 JSFunction); |
806 } | 900 } |
807 | 901 |
808 | 902 |
809 Handle<JSFunction> Factory::NewFunction(Handle<String> name, | 903 Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
810 Handle<Object> prototype) { | 904 Handle<Object> prototype) { |
811 Handle<JSFunction> fun = NewFunctionHelper(name, prototype); | 905 Handle<JSFunction> fun = NewFunctionHelper(name, prototype); |
812 fun->set_context(Top::context()->global_context()); | 906 fun->set_context(isolate()->context()->global_context()); |
813 return fun; | 907 return fun; |
814 } | 908 } |
815 | 909 |
816 | 910 |
817 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper( | 911 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper( |
818 Handle<String> name, | 912 Handle<String> name, |
819 StrictModeFlag strict_mode) { | 913 StrictModeFlag strict_mode) { |
820 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); | 914 Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); |
821 Handle<Map> map = strict_mode == kStrictMode | 915 Handle<Map> map = strict_mode == kStrictMode |
822 ? Top::strict_mode_function_without_prototype_map() | 916 ? isolate()->strict_mode_function_without_prototype_map() |
823 : Top::function_without_prototype_map(); | 917 : isolate()->function_without_prototype_map(); |
824 CALL_HEAP_FUNCTION(Heap::AllocateFunction( | 918 CALL_HEAP_FUNCTION(isolate(), |
| 919 isolate()->heap()->AllocateFunction( |
825 *map, | 920 *map, |
826 *function_share, | 921 *function_share, |
827 *the_hole_value()), | 922 *the_hole_value()), |
828 JSFunction); | 923 JSFunction); |
829 } | 924 } |
830 | 925 |
831 | 926 |
832 Handle<JSFunction> Factory::NewFunctionWithoutPrototype( | 927 Handle<JSFunction> Factory::NewFunctionWithoutPrototype( |
833 Handle<String> name, | 928 Handle<String> name, |
834 StrictModeFlag strict_mode) { | 929 StrictModeFlag strict_mode) { |
835 Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name, strict_mode); | 930 Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name, strict_mode); |
836 fun->set_context(Top::context()->global_context()); | 931 fun->set_context(isolate()->context()->global_context()); |
837 return fun; | 932 return fun; |
838 } | 933 } |
839 | 934 |
840 | 935 |
841 Handle<Object> Factory::ToObject(Handle<Object> object) { | 936 Handle<Object> Factory::ToObject(Handle<Object> object) { |
842 CALL_HEAP_FUNCTION(object->ToObject(), Object); | 937 CALL_HEAP_FUNCTION(isolate(), object->ToObject(), Object); |
843 } | 938 } |
844 | 939 |
845 | 940 |
846 Handle<Object> Factory::ToObject(Handle<Object> object, | 941 Handle<Object> Factory::ToObject(Handle<Object> object, |
847 Handle<Context> global_context) { | 942 Handle<Context> global_context) { |
848 CALL_HEAP_FUNCTION(object->ToObject(*global_context), Object); | 943 CALL_HEAP_FUNCTION(isolate(), object->ToObject(*global_context), Object); |
849 } | 944 } |
850 | 945 |
851 | 946 |
852 #ifdef ENABLE_DEBUGGER_SUPPORT | 947 #ifdef ENABLE_DEBUGGER_SUPPORT |
853 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { | 948 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { |
854 // Get the original code of the function. | 949 // Get the original code of the function. |
855 Handle<Code> code(shared->code()); | 950 Handle<Code> code(shared->code()); |
856 | 951 |
857 // Create a copy of the code before allocating the debug info object to avoid | 952 // Create a copy of the code before allocating the debug info object to avoid |
858 // allocation while setting up the debug info object. | 953 // allocation while setting up the debug info object. |
859 Handle<Code> original_code(*Factory::CopyCode(code)); | 954 Handle<Code> original_code(*Factory::CopyCode(code)); |
860 | 955 |
861 // Allocate initial fixed array for active break points before allocating the | 956 // Allocate initial fixed array for active break points before allocating the |
862 // debug info object to avoid allocation while setting up the debug info | 957 // debug info object to avoid allocation while setting up the debug info |
863 // object. | 958 // object. |
864 Handle<FixedArray> break_points( | 959 Handle<FixedArray> break_points( |
865 Factory::NewFixedArray(Debug::kEstimatedNofBreakPointsInFunction)); | 960 NewFixedArray(Debug::kEstimatedNofBreakPointsInFunction)); |
866 | 961 |
867 // Create and set up the debug info object. Debug info contains function, a | 962 // Create and set up the debug info object. Debug info contains function, a |
868 // copy of the original code, the executing code and initial fixed array for | 963 // copy of the original code, the executing code and initial fixed array for |
869 // active break points. | 964 // active break points. |
870 Handle<DebugInfo> debug_info = | 965 Handle<DebugInfo> debug_info = |
871 Handle<DebugInfo>::cast(Factory::NewStruct(DEBUG_INFO_TYPE)); | 966 Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); |
872 debug_info->set_shared(*shared); | 967 debug_info->set_shared(*shared); |
873 debug_info->set_original_code(*original_code); | 968 debug_info->set_original_code(*original_code); |
874 debug_info->set_code(*code); | 969 debug_info->set_code(*code); |
875 debug_info->set_break_points(*break_points); | 970 debug_info->set_break_points(*break_points); |
876 | 971 |
877 // Link debug info to function. | 972 // Link debug info to function. |
878 shared->set_debug_info(*debug_info); | 973 shared->set_debug_info(*debug_info); |
879 | 974 |
880 return debug_info; | 975 return debug_info; |
881 } | 976 } |
882 #endif | 977 #endif |
883 | 978 |
884 | 979 |
885 Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee, | 980 Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee, |
886 int length) { | 981 int length) { |
887 CALL_HEAP_FUNCTION(Heap::AllocateArgumentsObject(*callee, length), JSObject); | 982 CALL_HEAP_FUNCTION( |
| 983 isolate(), |
| 984 isolate()->heap()->AllocateArgumentsObject(*callee, length), JSObject); |
888 } | 985 } |
889 | 986 |
890 | 987 |
891 Handle<JSFunction> Factory::CreateApiFunction( | 988 Handle<JSFunction> Factory::CreateApiFunction( |
892 Handle<FunctionTemplateInfo> obj, ApiInstanceType instance_type) { | 989 Handle<FunctionTemplateInfo> obj, ApiInstanceType instance_type) { |
893 Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::HandleApiCall)); | 990 Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( |
| 991 Builtins::HandleApiCall)); |
894 Handle<Code> construct_stub = | 992 Handle<Code> construct_stub = |
895 Handle<Code>(Builtins::builtin(Builtins::JSConstructStubApi)); | 993 Handle<Code>(isolate()->builtins()->builtin( |
| 994 Builtins::JSConstructStubApi)); |
896 | 995 |
897 int internal_field_count = 0; | 996 int internal_field_count = 0; |
898 if (!obj->instance_template()->IsUndefined()) { | 997 if (!obj->instance_template()->IsUndefined()) { |
899 Handle<ObjectTemplateInfo> instance_template = | 998 Handle<ObjectTemplateInfo> instance_template = |
900 Handle<ObjectTemplateInfo>( | 999 Handle<ObjectTemplateInfo>( |
901 ObjectTemplateInfo::cast(obj->instance_template())); | 1000 ObjectTemplateInfo::cast(obj->instance_template())); |
902 internal_field_count = | 1001 internal_field_count = |
903 Smi::cast(instance_template->internal_field_count())->value(); | 1002 Smi::cast(instance_template->internal_field_count())->value(); |
904 } | 1003 } |
905 | 1004 |
(...skipping 11 matching lines...) Expand all Loading... |
917 case OuterGlobalObject: | 1016 case OuterGlobalObject: |
918 type = JS_GLOBAL_PROXY_TYPE; | 1017 type = JS_GLOBAL_PROXY_TYPE; |
919 instance_size += JSGlobalProxy::kSize; | 1018 instance_size += JSGlobalProxy::kSize; |
920 break; | 1019 break; |
921 default: | 1020 default: |
922 break; | 1021 break; |
923 } | 1022 } |
924 ASSERT(type != INVALID_TYPE); | 1023 ASSERT(type != INVALID_TYPE); |
925 | 1024 |
926 Handle<JSFunction> result = | 1025 Handle<JSFunction> result = |
927 Factory::NewFunction(Factory::empty_symbol(), | 1026 NewFunction(Factory::empty_symbol(), |
928 type, | 1027 type, |
929 instance_size, | 1028 instance_size, |
930 code, | 1029 code, |
931 true); | 1030 true); |
932 // Set class name. | 1031 // Set class name. |
933 Handle<Object> class_name = Handle<Object>(obj->class_name()); | 1032 Handle<Object> class_name = Handle<Object>(obj->class_name()); |
934 if (class_name->IsString()) { | 1033 if (class_name->IsString()) { |
935 result->shared()->set_instance_class_name(*class_name); | 1034 result->shared()->set_instance_class_name(*class_name); |
936 result->shared()->set_name(*class_name); | 1035 result->shared()->set_name(*class_name); |
937 } | 1036 } |
938 | 1037 |
939 Handle<Map> map = Handle<Map>(result->initial_map()); | 1038 Handle<Map> map = Handle<Map>(result->initial_map()); |
940 | 1039 |
941 // Mark as undetectable if needed. | 1040 // Mark as undetectable if needed. |
(...skipping 27 matching lines...) Expand all Loading... |
969 result->shared()->set_function_data(*obj); | 1068 result->shared()->set_function_data(*obj); |
970 result->shared()->set_construct_stub(*construct_stub); | 1069 result->shared()->set_construct_stub(*construct_stub); |
971 result->shared()->DontAdaptArguments(); | 1070 result->shared()->DontAdaptArguments(); |
972 | 1071 |
973 // Recursively copy parent templates' accessors, 'data' may be modified. | 1072 // Recursively copy parent templates' accessors, 'data' may be modified. |
974 Handle<DescriptorArray> array = | 1073 Handle<DescriptorArray> array = |
975 Handle<DescriptorArray>(map->instance_descriptors()); | 1074 Handle<DescriptorArray>(map->instance_descriptors()); |
976 while (true) { | 1075 while (true) { |
977 Handle<Object> props = Handle<Object>(obj->property_accessors()); | 1076 Handle<Object> props = Handle<Object>(obj->property_accessors()); |
978 if (!props->IsUndefined()) { | 1077 if (!props->IsUndefined()) { |
979 array = Factory::CopyAppendCallbackDescriptors(array, props); | 1078 array = CopyAppendCallbackDescriptors(array, props); |
980 } | 1079 } |
981 Handle<Object> parent = Handle<Object>(obj->parent_template()); | 1080 Handle<Object> parent = Handle<Object>(obj->parent_template()); |
982 if (parent->IsUndefined()) break; | 1081 if (parent->IsUndefined()) break; |
983 obj = Handle<FunctionTemplateInfo>::cast(parent); | 1082 obj = Handle<FunctionTemplateInfo>::cast(parent); |
984 } | 1083 } |
985 if (!array->IsEmpty()) { | 1084 if (!array->IsEmpty()) { |
986 map->set_instance_descriptors(*array); | 1085 map->set_instance_descriptors(*array); |
987 } | 1086 } |
988 | 1087 |
989 ASSERT(result->shared()->IsApiFunction()); | 1088 ASSERT(result->shared()->IsApiFunction()); |
990 return result; | 1089 return result; |
991 } | 1090 } |
992 | 1091 |
993 | 1092 |
994 Handle<MapCache> Factory::NewMapCache(int at_least_space_for) { | 1093 Handle<MapCache> Factory::NewMapCache(int at_least_space_for) { |
995 CALL_HEAP_FUNCTION(MapCache::Allocate(at_least_space_for), MapCache); | 1094 CALL_HEAP_FUNCTION(isolate(), |
| 1095 MapCache::Allocate(at_least_space_for), MapCache); |
996 } | 1096 } |
997 | 1097 |
998 | 1098 |
999 MUST_USE_RESULT static MaybeObject* UpdateMapCacheWith(Context* context, | 1099 MUST_USE_RESULT static MaybeObject* UpdateMapCacheWith(Context* context, |
1000 FixedArray* keys, | 1100 FixedArray* keys, |
1001 Map* map) { | 1101 Map* map) { |
1002 Object* result; | 1102 Object* result; |
1003 { MaybeObject* maybe_result = | 1103 { MaybeObject* maybe_result = |
1004 MapCache::cast(context->map_cache())->Put(keys, map); | 1104 MapCache::cast(context->map_cache())->Put(keys, map); |
1005 if (!maybe_result->ToObject(&result)) return maybe_result; | 1105 if (!maybe_result->ToObject(&result)) return maybe_result; |
1006 } | 1106 } |
1007 context->set_map_cache(MapCache::cast(result)); | 1107 context->set_map_cache(MapCache::cast(result)); |
1008 return result; | 1108 return result; |
1009 } | 1109 } |
1010 | 1110 |
1011 | 1111 |
1012 Handle<MapCache> Factory::AddToMapCache(Handle<Context> context, | 1112 Handle<MapCache> Factory::AddToMapCache(Handle<Context> context, |
1013 Handle<FixedArray> keys, | 1113 Handle<FixedArray> keys, |
1014 Handle<Map> map) { | 1114 Handle<Map> map) { |
1015 CALL_HEAP_FUNCTION(UpdateMapCacheWith(*context, *keys, *map), MapCache); | 1115 CALL_HEAP_FUNCTION(isolate(), |
| 1116 UpdateMapCacheWith(*context, *keys, *map), MapCache); |
1016 } | 1117 } |
1017 | 1118 |
1018 | 1119 |
1019 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, | 1120 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, |
1020 Handle<FixedArray> keys) { | 1121 Handle<FixedArray> keys) { |
1021 if (context->map_cache()->IsUndefined()) { | 1122 if (context->map_cache()->IsUndefined()) { |
1022 // Allocate the new map cache for the global context. | 1123 // Allocate the new map cache for the global context. |
1023 Handle<MapCache> new_cache = NewMapCache(24); | 1124 Handle<MapCache> new_cache = NewMapCache(24); |
1024 context->set_map_cache(*new_cache); | 1125 context->set_map_cache(*new_cache); |
1025 } | 1126 } |
(...skipping 28 matching lines...) Expand all Loading... |
1054 void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp, | 1155 void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp, |
1055 JSRegExp::Type type, | 1156 JSRegExp::Type type, |
1056 Handle<String> source, | 1157 Handle<String> source, |
1057 JSRegExp::Flags flags, | 1158 JSRegExp::Flags flags, |
1058 int capture_count) { | 1159 int capture_count) { |
1059 Handle<FixedArray> store = NewFixedArray(JSRegExp::kIrregexpDataSize); | 1160 Handle<FixedArray> store = NewFixedArray(JSRegExp::kIrregexpDataSize); |
1060 | 1161 |
1061 store->set(JSRegExp::kTagIndex, Smi::FromInt(type)); | 1162 store->set(JSRegExp::kTagIndex, Smi::FromInt(type)); |
1062 store->set(JSRegExp::kSourceIndex, *source); | 1163 store->set(JSRegExp::kSourceIndex, *source); |
1063 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value())); | 1164 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value())); |
1064 store->set(JSRegExp::kIrregexpASCIICodeIndex, Heap::the_hole_value()); | 1165 store->set(JSRegExp::kIrregexpASCIICodeIndex, HEAP->the_hole_value()); |
1065 store->set(JSRegExp::kIrregexpUC16CodeIndex, Heap::the_hole_value()); | 1166 store->set(JSRegExp::kIrregexpUC16CodeIndex, HEAP->the_hole_value()); |
1066 store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(0)); | 1167 store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(0)); |
1067 store->set(JSRegExp::kIrregexpCaptureCountIndex, | 1168 store->set(JSRegExp::kIrregexpCaptureCountIndex, |
1068 Smi::FromInt(capture_count)); | 1169 Smi::FromInt(capture_count)); |
1069 regexp->set_data(*store); | 1170 regexp->set_data(*store); |
1070 } | 1171 } |
1071 | 1172 |
1072 | 1173 |
1073 | 1174 |
1074 void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc, | 1175 void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc, |
1075 Handle<JSObject> instance, | 1176 Handle<JSObject> instance, |
1076 bool* pending_exception) { | 1177 bool* pending_exception) { |
1077 // Configure the instance by adding the properties specified by the | 1178 // Configure the instance by adding the properties specified by the |
1078 // instance template. | 1179 // instance template. |
1079 Handle<Object> instance_template = Handle<Object>(desc->instance_template()); | 1180 Handle<Object> instance_template = Handle<Object>(desc->instance_template()); |
1080 if (!instance_template->IsUndefined()) { | 1181 if (!instance_template->IsUndefined()) { |
1081 Execution::ConfigureInstance(instance, | 1182 Execution::ConfigureInstance(instance, |
1082 instance_template, | 1183 instance_template, |
1083 pending_exception); | 1184 pending_exception); |
1084 } else { | 1185 } else { |
1085 *pending_exception = false; | 1186 *pending_exception = false; |
1086 } | 1187 } |
1087 } | 1188 } |
1088 | 1189 |
1089 | 1190 |
1090 } } // namespace v8::internal | 1191 } } // namespace v8::internal |
OLD | NEW |