| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
| 9 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
| 10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 return *value; | 408 return *value; |
| 409 } | 409 } |
| 410 | 410 |
| 411 | 411 |
| 412 namespace { | 412 namespace { |
| 413 | 413 |
| 414 template <typename T> | 414 template <typename T> |
| 415 Handle<JSObject> NewSloppyArguments(Isolate* isolate, Handle<JSFunction> callee, | 415 Handle<JSObject> NewSloppyArguments(Isolate* isolate, Handle<JSFunction> callee, |
| 416 T parameters, int argument_count) { | 416 T parameters, int argument_count) { |
| 417 CHECK(!IsSubclassConstructor(callee->shared()->kind())); | 417 CHECK(!IsSubclassConstructor(callee->shared()->kind())); |
| 418 DCHECK(callee->has_simple_parameters()); | 418 DCHECK(callee->shared()->has_simple_parameters()); |
| 419 Handle<JSObject> result = | 419 Handle<JSObject> result = |
| 420 isolate->factory()->NewArgumentsObject(callee, argument_count); | 420 isolate->factory()->NewArgumentsObject(callee, argument_count); |
| 421 | 421 |
| 422 // Allocate the elements if needed. | 422 // Allocate the elements if needed. |
| 423 int parameter_count = callee->shared()->internal_formal_parameter_count(); | 423 int parameter_count = callee->shared()->internal_formal_parameter_count(); |
| 424 if (argument_count > 0) { | 424 if (argument_count > 0) { |
| 425 if (parameter_count > 0) { | 425 if (parameter_count > 0) { |
| 426 int mapped_count = Min(argument_count, parameter_count); | 426 int mapped_count = Min(argument_count, parameter_count); |
| 427 Handle<FixedArray> parameter_map = | 427 Handle<FixedArray> parameter_map = |
| 428 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); | 428 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 Handle<ScriptContextTable> script_context_table( | 666 Handle<ScriptContextTable> script_context_table( |
| 667 native_context->script_context_table()); | 667 native_context->script_context_table()); |
| 668 | 668 |
| 669 Object* name_clash_result = | 669 Object* name_clash_result = |
| 670 FindNameClash(scope_info, global_object, script_context_table); | 670 FindNameClash(scope_info, global_object, script_context_table); |
| 671 if (isolate->has_pending_exception()) return name_clash_result; | 671 if (isolate->has_pending_exception()) return name_clash_result; |
| 672 | 672 |
| 673 // Script contexts have a canonical empty function as their closure, not the | 673 // Script contexts have a canonical empty function as their closure, not the |
| 674 // anonymous closure containing the global code. See | 674 // anonymous closure containing the global code. See |
| 675 // FullCodeGenerator::PushFunctionArgumentForContextAllocation. | 675 // FullCodeGenerator::PushFunctionArgumentForContextAllocation. |
| 676 Handle<JSFunction> closure(function->IsBuiltin() ? *function | 676 Handle<JSFunction> closure( |
| 677 : native_context->closure()); | 677 function->shared()->IsBuiltin() ? *function : native_context->closure()); |
| 678 Handle<Context> result = | 678 Handle<Context> result = |
| 679 isolate->factory()->NewScriptContext(closure, scope_info); | 679 isolate->factory()->NewScriptContext(closure, scope_info); |
| 680 | 680 |
| 681 result->InitializeGlobalSlots(); | 681 result->InitializeGlobalSlots(); |
| 682 | 682 |
| 683 DCHECK(function->context() == isolate->context()); | 683 DCHECK(function->context() == isolate->context()); |
| 684 DCHECK(*global_object == result->global_object()); | 684 DCHECK(*global_object == result->global_object()); |
| 685 | 685 |
| 686 Handle<ScriptContextTable> new_script_context_table = | 686 Handle<ScriptContextTable> new_script_context_table = |
| 687 ScriptContextTable::Extend(script_context_table, result); | 687 ScriptContextTable::Extend(script_context_table, result); |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 | 1166 |
| 1167 // Lookup in the initial Object.prototype object. | 1167 // Lookup in the initial Object.prototype object. |
| 1168 Handle<Object> result; | 1168 Handle<Object> result; |
| 1169 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1169 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 1170 isolate, result, | 1170 isolate, result, |
| 1171 Object::GetProperty(isolate->initial_object_prototype(), key)); | 1171 Object::GetProperty(isolate->initial_object_prototype(), key)); |
| 1172 return *result; | 1172 return *result; |
| 1173 } | 1173 } |
| 1174 } // namespace internal | 1174 } // namespace internal |
| 1175 } // namespace v8 | 1175 } // namespace v8 |
| OLD | NEW |