Commit 0cf4a0f8 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by Commit Bot

[runtime] Delete obsolete runtime functions.

Remove the following runtime functions, which are not used throughout
the code base anymore:

  - %GetWeakMapEntries
  - %GetWeakSetValues
  - %MapIteratorClone
  - %SetIteratorClone
  - %StringNotEqual
  - %FunctionGetName
  - %IsConstructor
  - %SetCode

Bug: v8:8015
Change-Id: Iaf441d58e9b9bc77ef5bf93cb82ada87fb1ff5a7
Reviewed-on: https://chromium-review.googlesource.com/1238574
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56136}
parent 64b0c307
......@@ -167,7 +167,6 @@ bool Linkage::NeedsFrameStateInput(Runtime::FunctionId function) {
case Runtime::kPushCatchContext:
case Runtime::kReThrow:
case Runtime::kStringEqual:
case Runtime::kStringNotEqual:
case Runtime::kStringLessThan:
case Runtime::kStringLessThanOrEqual:
case Runtime::kStringGreaterThan:
......
......@@ -3102,26 +3102,6 @@ Handle<JSSet> Factory::NewJSSet() {
return js_set;
}
Handle<JSMapIterator> Factory::NewJSMapIterator(Handle<Map> map,
Handle<OrderedHashMap> table,
int index) {
Handle<JSMapIterator> result =
Handle<JSMapIterator>::cast(NewJSObjectFromMap(map));
result->set_table(*table);
result->set_index(Smi::FromInt(index));
return result;
}
Handle<JSSetIterator> Factory::NewJSSetIterator(Handle<Map> map,
Handle<OrderedHashSet> table,
int index) {
Handle<JSSetIterator> result =
Handle<JSSetIterator>::cast(NewJSObjectFromMap(map));
result->set_table(*table);
result->set_index(Smi::FromInt(index));
return result;
}
void Factory::TypeAndSizeForElementsKind(ElementsKind kind,
ExternalArrayType* array_type,
size_t* element_size) {
......
......@@ -668,13 +668,6 @@ class V8_EXPORT_PRIVATE Factory {
Handle<JSMap> NewJSMap();
Handle<JSSet> NewJSSet();
Handle<JSMapIterator> NewJSMapIterator(Handle<Map> map,
Handle<OrderedHashMap> table,
int index);
Handle<JSSetIterator> NewJSSetIterator(Handle<Map> map,
Handle<OrderedHashSet> table,
int index);
// Allocates a bound function.
MaybeHandle<JSBoundFunction> NewJSBoundFunction(
Handle<JSReceiver> target_function, Handle<Object> bound_this,
......
......@@ -39,16 +39,6 @@ RUNTIME_FUNCTION(Runtime_SetShrink) {
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(Runtime_SetIteratorClone) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0);
return *isolate->factory()->NewJSSetIterator(
handle(holder->map(), isolate),
handle(OrderedHashSet::cast(holder->table()), isolate),
Smi::ToInt(holder->index()));
}
RUNTIME_FUNCTION(Runtime_MapShrink) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
......@@ -69,25 +59,6 @@ RUNTIME_FUNCTION(Runtime_MapGrow) {
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(Runtime_MapIteratorClone) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0);
return *isolate->factory()->NewJSMapIterator(
handle(holder->map(), isolate),
handle(OrderedHashMap::cast(holder->table()), isolate),
Smi::ToInt(holder->index()));
}
RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0);
CONVERT_NUMBER_CHECKED(int, max_entries, Int32, args[1]);
CHECK_GE(max_entries, 0);
return *JSWeakCollection::GetEntries(holder, max_entries);
}
RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) {
HandleScope scope(isolate);
DCHECK_EQ(3, args.length());
......@@ -110,15 +81,6 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) {
return isolate->heap()->ToBoolean(was_present);
}
RUNTIME_FUNCTION(Runtime_GetWeakSetValues) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0);
CONVERT_NUMBER_CHECKED(int, max_values, Int32, args[1]);
CHECK_GE(max_values, 0);
return *JSWeakCollection::GetEntries(holder, max_values);
}
RUNTIME_FUNCTION(Runtime_WeakCollectionSet) {
HandleScope scope(isolate);
DCHECK_EQ(4, args.length());
......
......@@ -12,20 +12,6 @@
namespace v8 {
namespace internal {
RUNTIME_FUNCTION(Runtime_FunctionGetName) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
if (function->IsJSBoundFunction()) {
RETURN_RESULT_OR_FAILURE(
isolate, JSBoundFunction::GetName(
isolate, Handle<JSBoundFunction>::cast(function)));
} else {
return *JSFunction::GetName(isolate, Handle<JSFunction>::cast(function));
}
}
// TODO(5530): Remove once uses in debug.js are gone.
RUNTIME_FUNCTION(Runtime_FunctionGetScriptSource) {
HandleScope scope(isolate);
......@@ -87,64 +73,6 @@ RUNTIME_FUNCTION(Runtime_FunctionIsAPIFunction) {
}
RUNTIME_FUNCTION(Runtime_SetCode) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, source, 1);
Handle<SharedFunctionInfo> target_shared(target->shared(), isolate);
Handle<SharedFunctionInfo> source_shared(source->shared(), isolate);
if (!source->is_compiled() &&
!Compiler::Compile(source, Compiler::KEEP_EXCEPTION)) {
return ReadOnlyRoots(isolate).exception();
}
// Set the function data, scope info, formal parameter count, and the length
// of the target shared function info.
target_shared->set_function_data(source_shared->function_data());
target_shared->set_length(source_shared->GetLength());
target_shared->set_raw_outer_scope_info_or_feedback_metadata(
source_shared->raw_outer_scope_info_or_feedback_metadata());
target_shared->set_internal_formal_parameter_count(
source_shared->internal_formal_parameter_count());
bool was_native = target_shared->native();
target_shared->set_flags(source_shared->flags());
target_shared->set_native(was_native);
target_shared->set_scope_info(source_shared->scope_info());
Handle<Object> source_script(source_shared->script(), isolate);
int function_literal_id = source_shared->FunctionLiteralId(isolate);
if (source_script->IsScript()) {
SharedFunctionInfo::SetScript(source_shared,
isolate->factory()->undefined_value(),
function_literal_id);
}
SharedFunctionInfo::SetScript(target_shared, source_script,
function_literal_id);
// Set the code of the target function.
target->set_code(source_shared->GetCode());
Handle<Context> context(source->context(), isolate);
target->set_context(*context);
// Make sure we get a fresh copy of the feedback vector to avoid cross
// context contamination, and that the feedback vector makes it's way into
// the target_shared optimized code map.
JSFunction::EnsureFeedbackVector(target);
if (isolate->logger()->is_listening_to_code_events() ||
isolate->is_profiling()) {
isolate->logger()->LogExistingFunction(
source_shared, handle(source_shared->abstract_code(), isolate));
}
return *target;
}
// Set the native flag on the function.
// This is used to decide if we should transform null and undefined
// into the global object when doing call and apply.
......@@ -162,14 +90,6 @@ RUNTIME_FUNCTION(Runtime_SetNativeFlag) {
}
RUNTIME_FUNCTION(Runtime_IsConstructor) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Object, object, 0);
return isolate->heap()->ToBoolean(object->IsConstructor());
}
RUNTIME_FUNCTION(Runtime_Call) {
HandleScope scope(isolate);
DCHECK_LE(2, args.length());
......
......@@ -694,14 +694,6 @@ RUNTIME_FUNCTION(Runtime_StringEqual) {
return isolate->heap()->ToBoolean(String::Equals(isolate, x, y));
}
RUNTIME_FUNCTION(Runtime_StringNotEqual) {
HandleScope handle_scope(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
return isolate->heap()->ToBoolean(!String::Equals(isolate, x, y));
}
RUNTIME_FUNCTION(Runtime_FlattenString) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
......
......@@ -95,13 +95,9 @@ namespace internal {
F(ThrowUnsupportedSuperError, 0, 1)
#define FOR_EACH_INTRINSIC_COLLECTIONS(F) \
F(GetWeakMapEntries, 2, 1) \
F(GetWeakSetValues, 2, 1) \
F(MapGrow, 1, 1) \
F(MapIteratorClone, 1, 1) \
F(MapShrink, 1, 1) \
F(SetGrow, 1, 1) \
F(SetIteratorClone, 1, 1) \
F(SetShrink, 1, 1) \
F(TheHole, 0, 1) \
F(WeakCollectionDelete, 3, 1) \
......@@ -173,15 +169,12 @@ namespace internal {
#define FOR_EACH_INTRINSIC_FUNCTION(F) \
F(Call, -1 /* >= 2 */, 1) \
F(FunctionGetName, 1, 1) \
F(FunctionGetScriptSource, 1, 1) \
F(FunctionGetScriptId, 1, 1) \
F(FunctionGetScriptSourcePosition, 1, 1) \
F(FunctionGetSourceCode, 1, 1) \
F(FunctionIsAPIFunction, 1, 1) \
F(IsConstructor, 1, 1) \
F(IsFunction, 1, 1) \
F(SetCode, 2, 1) \
F(SetNativeFlag, 1, 1)
#define FOR_EACH_INTRINSIC_GENERATOR(F) \
......@@ -429,7 +422,6 @@ namespace internal {
F(StringLessThan, 2, 1) \
F(StringLessThanOrEqual, 2, 1) \
F(StringMaxLength, 0, 1) \
F(StringNotEqual, 2, 1) \
F(StringReplaceOneCharWithString, 3, 1) \
F(StringSubstring, 3, 1) \
F(StringToArray, 2, 1) \
......
......@@ -297,7 +297,7 @@ class SourceProcessor(SourceFileProcessor):
m = pattern.match(line)
if m:
runtime_functions.append(m.group(1))
if len(runtime_functions) < 450:
if len(runtime_functions) < 250:
print ("Runtime functions list is suspiciously short. "
"Consider updating the presubmit script.")
sys.exit(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment