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

Unified Diff: src/ast.h

Issue 1306993003: Call JS functions via native context instead of js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 4 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/assembler.cc ('k') | src/ast-value-factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 6e9390f6e3f62ebfe9d168b25993ffb0fef3a47c..6e817a07fea86b168a44748480fdd9609c720d9d 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -2032,51 +2032,45 @@ class CallRuntime final : public Expression {
public:
DECLARE_NODE_TYPE(CallRuntime)
- Handle<String> name() const { return raw_name_->string(); }
- const AstRawString* raw_name() const { return raw_name_; }
- const Runtime::Function* function() const { return function_; }
ZoneList<Expression*>* arguments() const { return arguments_; }
bool is_jsruntime() const { return function_ == NULL; }
- // Type feedback information.
- bool HasCallRuntimeFeedbackSlot() const { return is_jsruntime(); }
- virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
- Isolate* isolate, const ICSlotCache* cache) override {
- return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0);
- }
- void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
- ICSlotCache* cache) override {
- callruntime_feedback_slot_ = slot;
+ int context_index() const {
+ DCHECK(is_jsruntime());
+ return context_index_;
}
- Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; }
-
- FeedbackVectorICSlot CallRuntimeFeedbackSlot() {
- DCHECK(!HasCallRuntimeFeedbackSlot() ||
- !callruntime_feedback_slot_.IsInvalid());
- return callruntime_feedback_slot_;
+ const Runtime::Function* function() const {
+ DCHECK(!is_jsruntime());
+ return function_;
}
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;
+ }
+
protected:
- CallRuntime(Zone* zone, const AstRawString* name,
- const Runtime::Function* function,
+ CallRuntime(Zone* zone, const Runtime::Function* function,
ZoneList<Expression*>* arguments, int pos)
+ : Expression(zone, pos), function_(function), arguments_(arguments) {}
+
+ CallRuntime(Zone* zone, int context_index, ZoneList<Expression*>* arguments,
+ int pos)
: Expression(zone, pos),
- raw_name_(name),
- function_(function),
- arguments_(arguments),
- callruntime_feedback_slot_(FeedbackVectorICSlot::Invalid()) {}
+ function_(NULL),
+ context_index_(context_index),
+ arguments_(arguments) {}
+
static int parent_num_ids() { return Expression::num_ids(); }
private:
int local_id(int n) const { return base_id() + parent_num_ids() + n; }
- const AstRawString* raw_name_;
const Runtime::Function* function_;
+ int context_index_;
ZoneList<Expression*>* arguments_;
- FeedbackVectorICSlot callruntime_feedback_slot_;
};
@@ -3521,11 +3515,20 @@ class AstNodeFactory final BASE_EMBEDDED {
return new (zone_) CallNew(zone_, expression, arguments, pos);
}
- CallRuntime* NewCallRuntime(const AstRawString* name,
- const Runtime::Function* function,
- ZoneList<Expression*>* arguments,
- int pos) {
- return new (zone_) CallRuntime(zone_, name, function, arguments, pos);
+ CallRuntime* NewCallRuntime(Runtime::FunctionId id,
+ ZoneList<Expression*>* arguments, int pos) {
+ return new (zone_)
+ CallRuntime(zone_, Runtime::FunctionForId(id), arguments, pos);
+ }
+
+ CallRuntime* NewCallRuntime(const Runtime::Function* function,
+ ZoneList<Expression*>* arguments, int pos) {
+ return new (zone_) CallRuntime(zone_, function, arguments, pos);
+ }
+
+ CallRuntime* NewCallRuntime(int context_index,
+ ZoneList<Expression*>* arguments, int pos) {
+ return new (zone_) CallRuntime(zone_, context_index, arguments, pos);
}
UnaryOperation* NewUnaryOperation(Token::Value op,
« no previous file with comments | « src/assembler.cc ('k') | src/ast-value-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698