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

Unified Diff: src/code-stubs.h

Issue 477263002: ES6: Add support for method shorthand in object literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« src/ast.h ('K') | « src/ast.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index 4d021c2dc7dbe19c901d15753d288c1e8ad506ee..4aca6c7110c76e3e416b90924e2f41dde4fca633 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -592,12 +592,12 @@ class NumberToStringStub V8_FINAL : public HydrogenCodeStub {
class FastNewClosureStub : public HydrogenCodeStub {
public:
- FastNewClosureStub(Isolate* isolate,
- StrictMode strict_mode,
- bool is_generator)
+ FastNewClosureStub(Isolate* isolate, StrictMode strict_mode,
+ FunctionKind kind)
: HydrogenCodeStub(isolate),
strict_mode_(strict_mode),
- is_generator_(is_generator) { }
+ is_generator_(kind == FunctionKind::kGeneratorFunction),
+ is_concise_method_(kind == FunctionKind::kConciseMethod) {}
virtual Handle<Code> GenerateCode() V8_OVERRIDE;
@@ -608,19 +608,31 @@ class FastNewClosureStub : public HydrogenCodeStub {
StrictMode strict_mode() const { return strict_mode_; }
bool is_generator() const { return is_generator_; }
+ bool is_concise_method() const { return is_concise_method_; }
+ FunctionKind kind() const {
+ // TODO(arv): Update to handle concise generator methods.
+ // if (is_arrow()) return FunctionKind::kArrowFunction;
+ if (is_generator()) return FunctionKind::kGeneratorFunction;
+ if (is_concise_method()) return FunctionKind::kConciseMethod;
+ return FunctionKind::kNormalFunction;
+ }
private:
- class StrictModeBits: public BitField<bool, 0, 1> {};
- class IsGeneratorBits: public BitField<bool, 1, 1> {};
+ class StrictModeBits : public BitField<bool, 0, 1> {};
+ class IsGeneratorBits : public BitField<bool, 1, 1> {};
+ class IsMethodBits : public BitField<bool, 2, 1> {};
Major MajorKey() const { return FastNewClosure; }
int NotMissMinorKey() const {
return StrictModeBits::encode(strict_mode_ == STRICT) |
- IsGeneratorBits::encode(is_generator_);
+ IsGeneratorBits::encode(is_generator_) |
+ IsMethodBits::encode(is_concise_method_);
}
StrictMode strict_mode_;
+ // TODO(arv): Maybe store these as bits?
bool is_generator_;
+ bool is_concise_method_;
};
« src/ast.h ('K') | « src/ast.h ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698