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

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

Issue 1676883002: [runtime] Optimize and unify rest parameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/compiler/js-operator.h" 5 #include "src/compiler/js-operator.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/base/lazy-instance.h" 9 #include "src/base/lazy-instance.h"
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 return os << p.language_mode() << ", " << Brief(*p.name()); 343 return os << p.language_mode() << ", " << Brief(*p.name());
344 } 344 }
345 345
346 346
347 const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) { 347 const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) {
348 DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode()); 348 DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode());
349 return OpParameter<StoreGlobalParameters>(op); 349 return OpParameter<StoreGlobalParameters>(op);
350 } 350 }
351 351
352 352
353 bool operator==(CreateArgumentsParameters const& lhs, 353 CreateArgumentsType const& CreateArgumentsTypeOf(const Operator* op) {
354 CreateArgumentsParameters const& rhs) { 354 DCHECK_EQ(IrOpcode::kJSCreateArguments, op->opcode());
355 return lhs.type() == rhs.type() && lhs.start_index() == rhs.start_index(); 355 return OpParameter<CreateArgumentsType>(op);
356 } 356 }
357 357
358 358
359 bool operator!=(CreateArgumentsParameters const& lhs,
360 CreateArgumentsParameters const& rhs) {
361 return !(lhs == rhs);
362 }
363
364
365 size_t hash_value(CreateArgumentsParameters const& p) {
366 return base::hash_combine(p.type(), p.start_index());
367 }
368
369
370 std::ostream& operator<<(std::ostream& os, CreateArgumentsParameters const& p) {
371 return os << p.type() << ", " << p.start_index();
372 }
373
374
375 const CreateArgumentsParameters& CreateArgumentsParametersOf(
376 const Operator* op) {
377 DCHECK_EQ(IrOpcode::kJSCreateArguments, op->opcode());
378 return OpParameter<CreateArgumentsParameters>(op);
379 }
380
381
382 bool operator==(CreateArrayParameters const& lhs, 359 bool operator==(CreateArrayParameters const& lhs,
383 CreateArrayParameters const& rhs) { 360 CreateArrayParameters const& rhs) {
384 return lhs.arity() == rhs.arity() && 361 return lhs.arity() == rhs.arity() &&
385 lhs.site().location() == rhs.site().location(); 362 lhs.site().location() == rhs.site().location();
386 } 363 }
387 364
388 365
389 bool operator!=(CreateArrayParameters const& lhs, 366 bool operator!=(CreateArrayParameters const& lhs,
390 CreateArrayParameters const& rhs) { 367 CreateArrayParameters const& rhs) {
391 return !(lhs == rhs); 368 return !(lhs == rhs);
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 TypeofMode typeof_mode) { 858 TypeofMode typeof_mode) {
882 DynamicAccess access(name, typeof_mode); 859 DynamicAccess access(name, typeof_mode);
883 return new (zone()) Operator1<DynamicAccess>( // -- 860 return new (zone()) Operator1<DynamicAccess>( // --
884 IrOpcode::kJSLoadDynamic, Operator::kNoProperties, // opcode 861 IrOpcode::kJSLoadDynamic, Operator::kNoProperties, // opcode
885 "JSLoadDynamic", // name 862 "JSLoadDynamic", // name
886 2, 1, 1, 1, 1, 2, // counts 863 2, 1, 1, 1, 1, 2, // counts
887 access); // parameter 864 access); // parameter
888 } 865 }
889 866
890 867
891 const Operator* JSOperatorBuilder::CreateArguments( 868 const Operator* JSOperatorBuilder::CreateArguments(CreateArgumentsType type) {
892 CreateArgumentsParameters::Type type, int start_index) { 869 return new (zone()) Operator1<CreateArgumentsType>( // --
893 DCHECK_IMPLIES(start_index, type == CreateArgumentsParameters::kRestArray); 870 IrOpcode::kJSCreateArguments, Operator::kNoThrow, // opcode
894 CreateArgumentsParameters parameters(type, start_index); 871 "JSCreateArguments", // name
895 return new (zone()) Operator1<CreateArgumentsParameters>( // -- 872 1, 1, 1, 1, 1, 0, // counts
896 IrOpcode::kJSCreateArguments, Operator::kNoThrow, // opcode 873 type); // parameter
897 "JSCreateArguments", // name
898 1, 1, 1, 1, 1, 0, // counts
899 parameters); // parameter
900 } 874 }
901 875
902 876
903 const Operator* JSOperatorBuilder::CreateArray(size_t arity, 877 const Operator* JSOperatorBuilder::CreateArray(size_t arity,
904 Handle<AllocationSite> site) { 878 Handle<AllocationSite> site) {
905 // constructor, new_target, arg1, ..., argN 879 // constructor, new_target, arg1, ..., argN
906 int const value_input_count = static_cast<int>(arity) + 2; 880 int const value_input_count = static_cast<int>(arity) + 2;
907 CreateArrayParameters parameters(arity, site); 881 CreateArrayParameters parameters(arity, site);
908 return new (zone()) Operator1<CreateArrayParameters>( // -- 882 return new (zone()) Operator1<CreateArrayParameters>( // --
909 IrOpcode::kJSCreateArray, Operator::kNoProperties, // opcode 883 IrOpcode::kJSCreateArray, Operator::kNoProperties, // opcode
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- 970 return new (zone()) Operator1<Handle<ScopeInfo>>( // --
997 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode 971 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode
998 "JSCreateScriptContext", // name 972 "JSCreateScriptContext", // name
999 1, 1, 1, 1, 1, 2, // counts 973 1, 1, 1, 1, 1, 2, // counts
1000 scpope_info); // parameter 974 scpope_info); // parameter
1001 } 975 }
1002 976
1003 } // namespace compiler 977 } // namespace compiler
1004 } // namespace internal 978 } // namespace internal
1005 } // namespace v8 979 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698