Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "src/v8.h" | |
| 6 | |
| 7 #include "src/bootstrapper.h" | |
| 8 #include "src/code-factory.h" | |
| 9 #include "src/ic/ic.h" | |
| 10 | |
| 11 namespace v8 { | |
| 12 namespace internal { | |
| 13 | |
| 14 // static | |
| 15 Callable CodeFactory::LoadIC(Isolate* isolate, ContextualMode mode) { | |
| 16 return Callable( | |
| 17 LoadIC::initialize_stub(isolate, LoadIC::State(mode).GetExtraICState()), | |
| 18 LoadDescriptor(isolate)); | |
| 19 } | |
| 20 | |
| 21 | |
| 22 // static | |
| 23 Callable CodeFactory::KeyedLoadIC(Isolate* isolate) { | |
| 24 return Callable(isolate->builtins()->KeyedLoadIC_Initialize(), | |
| 25 LoadDescriptor(isolate)); | |
| 26 } | |
| 27 | |
| 28 | |
| 29 // static | |
| 30 Callable CodeFactory::StoreIC(Isolate* isolate, StrictMode mode) { | |
| 31 return Callable(StoreIC::initialize_stub(isolate, mode), | |
| 32 StoreDescriptor(isolate)); | |
| 33 } | |
| 34 | |
| 35 | |
| 36 // static | |
| 37 Callable CodeFactory::KeyedStoreIC(Isolate* isolate, StrictMode mode) { | |
| 38 Handle<Code> ic = mode == SLOPPY | |
| 39 ? isolate->builtins()->KeyedStoreIC_Initialize() | |
| 40 : isolate->builtins()->KeyedStoreIC_Initialize_Strict(); | |
| 41 return Callable(ic, StoreDescriptor(isolate)); | |
| 42 } | |
| 43 | |
| 44 | |
| 45 // static | |
| 46 Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op) { | |
| 47 Handle<Code> code = CompareIC::GetUninitialized(isolate, op); | |
| 48 return Callable(code, BinaryOpDescriptor(isolate)); | |
| 49 } | |
| 50 | |
| 51 | |
| 52 // static | |
| 53 Callable CodeFactory::BinaryOpIC(Isolate* isolate, Token::Value op, | |
| 54 OverwriteMode mode) { | |
| 55 BinaryOpICStub stub(isolate, op, mode); | |
| 56 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | |
| 57 } | |
| 58 | |
| 59 | |
| 60 // static | |
| 61 Callable CodeFactory::ToBoolean(Isolate* isolate, | |
| 62 ToBooleanStub::ResultMode mode, | |
| 63 ToBooleanStub::Types types) { | |
| 64 ToBooleanStub stub(isolate, mode, types); | |
| 65 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | |
| 66 } | |
| 67 | |
| 68 | |
| 69 // static | |
| 70 Callable CodeFactory::ToNumber(Isolate* isolate) { | |
| 71 ToNumberStub stub(isolate); | |
| 72 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | |
| 73 } | |
| 74 | |
| 75 | |
| 76 // static | |
| 77 Callable CodeFactory::StringAdd(Isolate* isolate, StringAddFlags flags, | |
| 78 PretenureFlag pretenure_flag) { | |
| 79 StringAddStub stub(isolate, flags, pretenure_flag); | |
| 80 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | |
| 81 } | |
| 82 | |
| 83 | |
| 84 // static | |
| 85 Callable CodeFactory::CallFunction(Isolate* isolate, int argc, | |
| 86 CallFunctionFlags flags) { | |
| 87 CallFunctionStub stub(isolate, argc, flags); | |
| 88 return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); | |
| 89 } | |
| 90 } | |
|
Michael Starzinger
2014/09/11 12:26:54
nit: Can we add the "// internal" and "// v8" comm
| |
| 91 } | |
| OLD | NEW |