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

Unified Diff: src/runtime/runtime-scopes.cc

Issue 1688163004: [runtime] Kill %Arguments and %ArgumentsLength. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@StringFromCharCode
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 1cf04a8dba04d7b7df4a74c379fdd09a0c6516b4..a8f3a749189196663b9f086725dc700df185b13e 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -1137,88 +1137,5 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) {
return *value;
}
-
-RUNTIME_FUNCTION(Runtime_ArgumentsLength) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 0);
- int argument_count = 0;
- GetCallerArguments(isolate, &argument_count);
- return Smi::FromInt(argument_count);
-}
-
-
-RUNTIME_FUNCTION(Runtime_Arguments) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(Object, raw_key, 0);
-
- // Determine the actual arguments passed to the function.
- int argument_count_signed = 0;
- base::SmartArrayPointer<Handle<Object>> arguments =
- GetCallerArguments(isolate, &argument_count_signed);
- const uint32_t argument_count = argument_count_signed;
-
- // Try to convert the key to an index. If successful and within
- // index return the the argument from the frame.
- uint32_t index = 0;
- if (raw_key->ToArrayIndex(&index) && index < argument_count) {
- return *arguments[index];
- }
-
- if (raw_key->IsSymbol()) {
- Handle<Symbol> symbol = Handle<Symbol>::cast(raw_key);
- if (Name::Equals(symbol, isolate->factory()->iterator_symbol())) {
- return isolate->native_context()->array_values_iterator();
- }
- // Lookup in the initial Object.prototype object.
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- Object::GetProperty(isolate->initial_object_prototype(),
- Handle<Symbol>::cast(raw_key)));
- return *result;
- }
-
- // Convert the key to a string.
- Handle<Object> converted;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, converted,
- Object::ToString(isolate, raw_key));
- Handle<String> key = Handle<String>::cast(converted);
-
- // Try to convert the string key into an array index.
- if (key->AsArrayIndex(&index)) {
- if (index < argument_count) {
- return *arguments[index];
- } else {
- Handle<Object> initial_prototype(isolate->initial_object_prototype());
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- Object::GetElement(isolate, initial_prototype, index));
- return *result;
- }
- }
-
- // Handle special arguments properties.
- if (String::Equals(isolate->factory()->length_string(), key)) {
- return Smi::FromInt(argument_count);
- }
- if (String::Equals(isolate->factory()->callee_string(), key)) {
- JavaScriptFrameIterator it(isolate);
- JSFunction* function = it.frame()->function();
- if (is_strict(function->shared()->language_mode())) {
- THROW_NEW_ERROR_RETURN_FAILURE(
- isolate, NewTypeError(MessageTemplate::kStrictPoisonPill));
- }
- return function;
- }
-
- // Lookup in the initial Object.prototype object.
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result,
- Object::GetProperty(isolate->initial_object_prototype(), key));
- return *result;
-}
} // namespace internal
} // namespace v8
« no previous file with comments | « src/runtime/runtime.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698