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

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 1114563003: Optimize the typeof operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. 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/code-stubs-hydrogen.cc ('k') | src/compiler/linkage.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 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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 REPLACE_COMPARE_IC_CALL(JSGreaterThan, Token::GT) 86 REPLACE_COMPARE_IC_CALL(JSGreaterThan, Token::GT)
87 REPLACE_COMPARE_IC_CALL(JSLessThanOrEqual, Token::LTE) 87 REPLACE_COMPARE_IC_CALL(JSLessThanOrEqual, Token::LTE)
88 REPLACE_COMPARE_IC_CALL(JSGreaterThanOrEqual, Token::GTE) 88 REPLACE_COMPARE_IC_CALL(JSGreaterThanOrEqual, Token::GTE)
89 #undef REPLACE_COMPARE_IC_CALL 89 #undef REPLACE_COMPARE_IC_CALL
90 90
91 91
92 #define REPLACE_RUNTIME_CALL(op, fun) \ 92 #define REPLACE_RUNTIME_CALL(op, fun) \
93 void JSGenericLowering::Lower##op(Node* node) { \ 93 void JSGenericLowering::Lower##op(Node* node) { \
94 ReplaceWithRuntimeCall(node, fun); \ 94 ReplaceWithRuntimeCall(node, fun); \
95 } 95 }
96 REPLACE_RUNTIME_CALL(JSTypeOf, Runtime::kTypeof)
97 REPLACE_RUNTIME_CALL(JSCreate, Runtime::kAbort) 96 REPLACE_RUNTIME_CALL(JSCreate, Runtime::kAbort)
98 REPLACE_RUNTIME_CALL(JSCreateFunctionContext, Runtime::kNewFunctionContext) 97 REPLACE_RUNTIME_CALL(JSCreateFunctionContext, Runtime::kNewFunctionContext)
99 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) 98 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext)
100 REPLACE_RUNTIME_CALL(JSCreateBlockContext, Runtime::kPushBlockContext) 99 REPLACE_RUNTIME_CALL(JSCreateBlockContext, Runtime::kPushBlockContext)
101 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) 100 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext)
102 REPLACE_RUNTIME_CALL(JSCreateScriptContext, Runtime::kNewScriptContext) 101 REPLACE_RUNTIME_CALL(JSCreateScriptContext, Runtime::kNewScriptContext)
103 #undef REPLACE_RUNTIME 102 #undef REPLACE_RUNTIME
104 103
105 104
106 #define REPLACE_UNIMPLEMENTED(op) \ 105 #define REPLACE_UNIMPLEMENTED(op) \
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 266 }
268 267
269 268
270 void JSGenericLowering::LowerJSUnaryNot(Node* node) { 269 void JSGenericLowering::LowerJSUnaryNot(Node* node) {
271 Callable callable = CodeFactory::ToBoolean( 270 Callable callable = CodeFactory::ToBoolean(
272 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL); 271 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
273 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 272 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
274 } 273 }
275 274
276 275
276 void JSGenericLowering::LowerJSTypeOf(Node* node) {
277 Callable callable = CodeFactory::Typeof(isolate());
278 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags);
279 }
280
281
277 void JSGenericLowering::LowerJSToBoolean(Node* node) { 282 void JSGenericLowering::LowerJSToBoolean(Node* node) {
278 Callable callable = 283 Callable callable =
279 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); 284 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
280 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 285 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
281 } 286 }
282 287
283 288
284 void JSGenericLowering::LowerJSToNumber(Node* node) { 289 void JSGenericLowering::LowerJSToNumber(Node* node) {
285 Callable callable = CodeFactory::ToNumber(isolate()); 290 Callable callable = CodeFactory::ToNumber(isolate());
286 ReplaceWithStubCall(node, callable, FlagsForNode(node)); 291 ReplaceWithStubCall(node, callable, FlagsForNode(node));
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 577 }
573 578
574 579
575 MachineOperatorBuilder* JSGenericLowering::machine() const { 580 MachineOperatorBuilder* JSGenericLowering::machine() const {
576 return jsgraph()->machine(); 581 return jsgraph()->machine();
577 } 582 }
578 583
579 } // namespace compiler 584 } // namespace compiler
580 } // namespace internal 585 } // namespace internal
581 } // namespace v8 586 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/compiler/linkage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698