Commit c6f925d7 authored by gsathya's avatar gsathya Committed by Commit bot

[ast] Annotate Runtime ast nodes

Changes output from
CALL RUNTIME (context function) code = 0x3e9ea90a2049 at -1
to
CALL RUNTIME async_function_promise_create code = 0x3e9ea90a2049 at -1

This makes the ast more useful. I didn't annotate all the runtime calls,
only some for now. We can annotate others if necessary.

Review-Url: https://codereview.chromium.org/2654113002
Cr-Commit-Position: refs/heads/master@{#42671}
parent bc7eb04d
......@@ -29,6 +29,21 @@ namespace internal {
#ifdef DEBUG
static const char* NameForNativeContextIntrinsicIndex(uint32_t idx) {
switch (idx) {
#define NATIVE_CONTEXT_FIELDS_IDX(NAME, Type, name) \
case Context::NAME: \
return #name;
NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELDS_IDX)
default:
break;
}
return "UnknownIntrinsicIndex";
}
void AstNode::Print() { Print(Isolate::Current()); }
void AstNode::Print(Isolate* isolate) {
......@@ -1064,5 +1079,13 @@ bool Literal::Match(void* literal1, void* literal2) {
(x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
}
const char* CallRuntime::debug_name() {
#ifdef DEBUG
return NameForNativeContextIntrinsicIndex(context_index_);
#else
return is_jsruntime() ? "(context function)" : function_->name;
#endif // DEBUG
}
} // namespace internal
} // namespace v8
......@@ -19,7 +19,6 @@
#include "src/parsing/token.h"
#include "src/runtime/runtime.h"
#include "src/small-pointer-list.h"
#include "src/utils.h"
namespace v8 {
namespace internal {
......@@ -2055,10 +2054,7 @@ class CallRuntime final : public Expression {
static int num_ids() { return parent_num_ids() + 1; }
BailoutId CallId() { return BailoutId(local_id(0)); }
const char* debug_name() {
return is_jsruntime() ? "(context function)" : function_->name;
}
const char* debug_name();
private:
friend class AstNodeFactory;
......
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