| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 | 278 |
| 279 | 279 |
| 280 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { | 280 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { |
| 281 CALL_HEAP_FUNCTION(array->Copy(), FixedArray); | 281 CALL_HEAP_FUNCTION(array->Copy(), FixedArray); |
| 282 } | 282 } |
| 283 | 283 |
| 284 | 284 |
| 285 Handle<JSFunction> Factory::BaseNewFunctionFromBoilerplate( | 285 Handle<JSFunction> Factory::BaseNewFunctionFromBoilerplate( |
| 286 Handle<JSFunction> boilerplate, | 286 Handle<JSFunction> boilerplate, |
| 287 Handle<Map> function_map) { | 287 Handle<Map> function_map, |
| 288 PretenureFlag pretenure) { |
| 288 ASSERT(boilerplate->IsBoilerplate()); | 289 ASSERT(boilerplate->IsBoilerplate()); |
| 289 ASSERT(!boilerplate->has_initial_map()); | 290 ASSERT(!boilerplate->has_initial_map()); |
| 290 ASSERT(!boilerplate->has_prototype()); | 291 ASSERT(!boilerplate->has_prototype()); |
| 291 ASSERT(boilerplate->properties() == Heap::empty_fixed_array()); | 292 ASSERT(boilerplate->properties() == Heap::empty_fixed_array()); |
| 292 ASSERT(boilerplate->elements() == Heap::empty_fixed_array()); | 293 ASSERT(boilerplate->elements() == Heap::empty_fixed_array()); |
| 293 CALL_HEAP_FUNCTION(Heap::AllocateFunction(*function_map, | 294 CALL_HEAP_FUNCTION(Heap::AllocateFunction(*function_map, |
| 294 boilerplate->shared(), | 295 boilerplate->shared(), |
| 295 Heap::the_hole_value()), | 296 Heap::the_hole_value(), |
| 297 pretenure), |
| 296 JSFunction); | 298 JSFunction); |
| 297 } | 299 } |
| 298 | 300 |
| 299 | 301 |
| 300 Handle<JSFunction> Factory::NewFunctionFromBoilerplate( | 302 Handle<JSFunction> Factory::NewFunctionFromBoilerplate( |
| 301 Handle<JSFunction> boilerplate, | 303 Handle<JSFunction> boilerplate, |
| 302 Handle<Context> context) { | 304 Handle<Context> context, |
| 303 Handle<JSFunction> result = | 305 PretenureFlag pretenure) { |
| 304 BaseNewFunctionFromBoilerplate(boilerplate, Top::function_map()); | 306 Handle<JSFunction> result = BaseNewFunctionFromBoilerplate( |
| 307 boilerplate, Top::function_map(), pretenure); |
| 305 result->set_context(*context); | 308 result->set_context(*context); |
| 306 int number_of_literals = boilerplate->NumberOfLiterals(); | 309 int number_of_literals = boilerplate->NumberOfLiterals(); |
| 307 Handle<FixedArray> literals = | 310 Handle<FixedArray> literals = |
| 308 Factory::NewFixedArray(number_of_literals, TENURED); | 311 Factory::NewFixedArray(number_of_literals, pretenure); |
| 309 if (number_of_literals > 0) { | 312 if (number_of_literals > 0) { |
| 310 // Store the object, regexp and array functions in the literals | 313 // Store the object, regexp and array functions in the literals |
| 311 // array prefix. These functions will be used when creating | 314 // array prefix. These functions will be used when creating |
| 312 // object, regexp and array literals in this function. | 315 // object, regexp and array literals in this function. |
| 313 literals->set(JSFunction::kLiteralGlobalContextIndex, | 316 literals->set(JSFunction::kLiteralGlobalContextIndex, |
| 314 context->global_context()); | 317 context->global_context()); |
| 315 } | 318 } |
| 316 result->set_literals(*literals); | 319 result->set_literals(*literals); |
| 317 ASSERT(!result->IsBoilerplate()); | 320 ASSERT(!result->IsBoilerplate()); |
| 318 return result; | 321 return result; |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 Execution::ConfigureInstance(instance, | 948 Execution::ConfigureInstance(instance, |
| 946 instance_template, | 949 instance_template, |
| 947 pending_exception); | 950 pending_exception); |
| 948 } else { | 951 } else { |
| 949 *pending_exception = false; | 952 *pending_exception = false; |
| 950 } | 953 } |
| 951 } | 954 } |
| 952 | 955 |
| 953 | 956 |
| 954 } } // namespace v8::internal | 957 } } // namespace v8::internal |
| OLD | NEW |