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

Side by Side Diff: src/compiler/js-operator.h

Issue 1107883002: [turbofan] Add language mode to JSCallFunction operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/js-operator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_COMPILER_JS_OPERATOR_H_ 5 #ifndef V8_COMPILER_JS_OPERATOR_H_
6 #define V8_COMPILER_JS_OPERATOR_H_ 6 #define V8_COMPILER_JS_OPERATOR_H_
7 7
8 #include "src/runtime/runtime.h" 8 #include "src/runtime/runtime.h"
9 #include "src/unique.h" 9 #include "src/unique.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 // Forward declarations. 15 // Forward declarations.
16 class Operator; 16 class Operator;
17 struct JSOperatorGlobalCache; 17 struct JSOperatorGlobalCache;
18 18
19 19
20 // Defines the arity and the call flags for a JavaScript function call. This is 20 // Defines the arity and the call flags for a JavaScript function call. This is
21 // used as a parameter by JSCallFunction operators. 21 // used as a parameter by JSCallFunction operators.
22 class CallFunctionParameters final { 22 class CallFunctionParameters final {
23 public: 23 public:
24 CallFunctionParameters(size_t arity, CallFunctionFlags flags) 24 CallFunctionParameters(size_t arity, CallFunctionFlags flags,
25 : arity_(arity), flags_(flags) {} 25 LanguageMode language_mode)
26 : bit_field_(ArityField::encode(arity) | FlagsField::encode(flags) |
27 LanguageModeField::encode(language_mode)) {}
26 28
27 size_t arity() const { return arity_; } 29 size_t arity() const { return ArityField::decode(bit_field_); }
28 CallFunctionFlags flags() const { return flags_; } 30 CallFunctionFlags flags() const { return FlagsField::decode(bit_field_); }
31 LanguageMode language_mode() const {
32 return LanguageModeField::decode(bit_field_);
33 }
34
35 bool operator==(CallFunctionParameters const& that) const {
36 return this->bit_field_ == that.bit_field_;
37 }
38 bool operator!=(CallFunctionParameters const& that) const {
39 return !(*this == that);
40 }
29 41
30 private: 42 private:
31 const size_t arity_; 43 friend size_t hash_value(CallFunctionParameters const& p) {
32 const CallFunctionFlags flags_; 44 return p.bit_field_;
45 }
46
47 typedef BitField<unsigned, 0, 28> ArityField;
48 typedef BitField<CallFunctionFlags, 28, 2> FlagsField;
49 typedef BitField<LanguageMode, 30, 2> LanguageModeField;
50
51 const uint32_t bit_field_;
33 }; 52 };
34 53
35 bool operator==(CallFunctionParameters const&, CallFunctionParameters const&);
36 bool operator!=(CallFunctionParameters const&, CallFunctionParameters const&);
37
38 size_t hash_value(CallFunctionParameters const&); 54 size_t hash_value(CallFunctionParameters const&);
39 55
40 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); 56 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&);
41 57
42 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op); 58 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op);
43 59
44 60
45 // Defines the arity and the ID for a runtime function call. This is used as a 61 // Defines the arity and the ID for a runtime function call. This is used as a
46 // parameter by JSCallRuntime operators. 62 // parameter by JSCallRuntime operators.
47 class CallRuntimeParameters final { 63 class CallRuntimeParameters final {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 const Operator* ToNumber(); 280 const Operator* ToNumber();
265 const Operator* ToString(); 281 const Operator* ToString();
266 const Operator* ToName(); 282 const Operator* ToName();
267 const Operator* ToObject(); 283 const Operator* ToObject();
268 const Operator* Yield(); 284 const Operator* Yield();
269 285
270 const Operator* Create(); 286 const Operator* Create();
271 const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info, 287 const Operator* CreateClosure(Handle<SharedFunctionInfo> shared_info,
272 PretenureFlag pretenure); 288 PretenureFlag pretenure);
273 289
274 const Operator* CallFunction(size_t arity, CallFunctionFlags flags); 290 const Operator* CallFunction(size_t arity, CallFunctionFlags flags,
291 LanguageMode language_mode);
275 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity); 292 const Operator* CallRuntime(Runtime::FunctionId id, size_t arity);
276 293
277 const Operator* CallConstruct(int arguments); 294 const Operator* CallConstruct(int arguments);
278 295
279 const Operator* LoadProperty(const VectorSlotPair& feedback); 296 const Operator* LoadProperty(const VectorSlotPair& feedback);
280 const Operator* LoadNamed(const Unique<Name>& name, 297 const Operator* LoadNamed(const Unique<Name>& name,
281 const VectorSlotPair& feedback, 298 const VectorSlotPair& feedback,
282 ContextualMode contextual_mode = NOT_CONTEXTUAL, 299 ContextualMode contextual_mode = NOT_CONTEXTUAL,
283 PropertyICMode load_ic = NAMED); 300 PropertyICMode load_ic = NAMED);
284 301
(...skipping 29 matching lines...) Expand all
314 Zone* const zone_; 331 Zone* const zone_;
315 332
316 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); 333 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder);
317 }; 334 };
318 335
319 } // namespace compiler 336 } // namespace compiler
320 } // namespace internal 337 } // namespace internal
321 } // namespace v8 338 } // namespace v8
322 339
323 #endif // V8_COMPILER_JS_OPERATOR_H_ 340 #endif // V8_COMPILER_JS_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.cc ('k') | src/compiler/js-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698