OLD | NEW |
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/graph-inl.h" | 8 #include "src/compiler/graph-inl.h" |
9 #include "src/compiler/js-generic-lowering.h" | 9 #include "src/compiler/js-generic-lowering.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 void JSGenericLowering::LowerJSToBoolean(Node* node) { | 226 void JSGenericLowering::LowerJSToBoolean(Node* node) { |
227 Callable callable = | 227 Callable callable = |
228 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); | 228 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); |
229 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); | 229 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); |
230 } | 230 } |
231 | 231 |
232 | 232 |
233 void JSGenericLowering::LowerJSToNumber(Node* node) { | 233 void JSGenericLowering::LowerJSToNumber(Node* node) { |
234 Callable callable = CodeFactory::ToNumber(isolate()); | 234 Callable callable = CodeFactory::ToNumber(isolate()); |
| 235 // TODO(mstarzinger): Embedding the context this way prevents sharing of code |
| 236 // across native contexts. |
| 237 if (!info_context_constant_.is_set()) { |
| 238 info_context_constant_.set(jsgraph()->HeapConstant(info()->context())); |
| 239 } |
| 240 node->ReplaceInput(1, info_context_constant_.get()); |
235 ReplaceWithStubCall(node, callable, FlagsForNode(node)); | 241 ReplaceWithStubCall(node, callable, FlagsForNode(node)); |
236 } | 242 } |
237 | 243 |
238 | 244 |
239 void JSGenericLowering::LowerJSToString(Node* node) { | 245 void JSGenericLowering::LowerJSToString(Node* node) { |
240 ReplaceWithBuiltinCall(node, Builtins::TO_STRING, 1); | 246 ReplaceWithBuiltinCall(node, Builtins::TO_STRING, 1); |
241 } | 247 } |
242 | 248 |
243 | 249 |
244 void JSGenericLowering::LowerJSToObject(Node* node) { | 250 void JSGenericLowering::LowerJSToObject(Node* node) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 425 |
420 | 426 |
421 void JSGenericLowering::LowerJSCallRuntime(Node* node) { | 427 void JSGenericLowering::LowerJSCallRuntime(Node* node) { |
422 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); | 428 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op()); |
423 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); | 429 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity())); |
424 } | 430 } |
425 | 431 |
426 } // namespace compiler | 432 } // namespace compiler |
427 } // namespace internal | 433 } // namespace internal |
428 } // namespace v8 | 434 } // namespace v8 |
OLD | NEW |