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/code-stubs.h

Issue 919703003: WIP: Implement ES6 Spread-calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: AssignmentExpressions are not spreadable, add cctests for parsing Created 5 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
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index fb2fbe55df5398d9ed4d7c0351b5a888e9b8d0c3..1832c430068c9ae1916a44776368325ae95f46f9 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -827,6 +827,7 @@ class CallICStub: public PlatformCodeStub {
}
int arg_count() const { return state().arg_count(); }
+ bool is_spread() const { return state().is_spread(); }
CallICState state() const {
return CallICState(static_cast<ExtraICState>(minor_key_));
@@ -1652,10 +1653,12 @@ class RegExpConstructResultStub FINAL : public HydrogenCodeStub {
class CallFunctionStub: public PlatformCodeStub {
public:
- CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags)
+ CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags,
+ bool is_spread = false)
: PlatformCodeStub(isolate) {
DCHECK(argc >= 0 && argc <= Code::kMaxArguments);
- minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags);
+ minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags) |
+ IsSpreadBits::encode(is_spread);
}
static int ExtractArgcFromMinorKey(int minor_key) {
@@ -1670,14 +1673,19 @@ class CallFunctionStub: public PlatformCodeStub {
return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL;
}
+ bool is_spread() const { return IsSpreadBits::decode(minor_key_); }
+
bool NeedsChecks() const { return flags() != WRAP_AND_CALL; }
void PrintName(std::ostream& os) const OVERRIDE; // NOLINT
// Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
class FlagBits : public BitField<CallFunctionFlags, 0, 2> {};
- class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {};
- STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);
+ class IsSpreadBits : public BitField<bool, FlagBits::kNext, 1> {};
+ class ArgcBits : public BitField<unsigned, IsSpreadBits::kNext,
+ Code::kArgumentsBits> {};
+
+ STATIC_ASSERT(Code::kArgumentsBits + 3 <= kStubMinorKeyBits);
DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction);
DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub);

Powered by Google App Engine
This is Rietveld 408576698