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

Side by Side Diff: src/runtime/runtime-scopes.cc

Issue 1221713003: Distinguish slow from fast sloppy arguments (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | src/x64/code-stubs-x64.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 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/v8.h" 5 #include "src/v8.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/messages.h" 10 #include "src/messages.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 isolate->factory()->NewArgumentsObject(callee, argument_count); 376 isolate->factory()->NewArgumentsObject(callee, argument_count);
377 377
378 // Allocate the elements if needed. 378 // Allocate the elements if needed.
379 int parameter_count = callee->shared()->internal_formal_parameter_count(); 379 int parameter_count = callee->shared()->internal_formal_parameter_count();
380 if (argument_count > 0) { 380 if (argument_count > 0) {
381 if (parameter_count > 0) { 381 if (parameter_count > 0) {
382 int mapped_count = Min(argument_count, parameter_count); 382 int mapped_count = Min(argument_count, parameter_count);
383 Handle<FixedArray> parameter_map = 383 Handle<FixedArray> parameter_map =
384 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); 384 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED);
385 parameter_map->set_map(isolate->heap()->sloppy_arguments_elements_map()); 385 parameter_map->set_map(isolate->heap()->sloppy_arguments_elements_map());
386 386 result->set_map(isolate->native_context()->fast_aliased_arguments_map());
387 Handle<Map> map = Map::Copy(handle(result->map()), "NewSloppyArguments");
388 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
389
390 result->set_map(*map);
391 result->set_elements(*parameter_map); 387 result->set_elements(*parameter_map);
392 388
393 // Store the context and the arguments array at the beginning of the 389 // Store the context and the arguments array at the beginning of the
394 // parameter map. 390 // parameter map.
395 Handle<Context> context(isolate->context()); 391 Handle<Context> context(isolate->context());
396 Handle<FixedArray> arguments = 392 Handle<FixedArray> arguments =
397 isolate->factory()->NewFixedArray(argument_count, NOT_TENURED); 393 isolate->factory()->NewFixedArray(argument_count, NOT_TENURED);
398 parameter_map->set(0, *context); 394 parameter_map->set(0, *context);
399 parameter_map->set(1, *arguments); 395 parameter_map->set(1, *arguments);
400 396
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 return Smi::FromInt(frame->GetArgumentsLength()); 1129 return Smi::FromInt(frame->GetArgumentsLength());
1134 } 1130 }
1135 1131
1136 1132
1137 RUNTIME_FUNCTION(Runtime_Arguments) { 1133 RUNTIME_FUNCTION(Runtime_Arguments) {
1138 SealHandleScope shs(isolate); 1134 SealHandleScope shs(isolate);
1139 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); 1135 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate);
1140 } 1136 }
1141 } // namespace internal 1137 } // namespace internal
1142 } // namespace v8 1138 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698