2014-09-11 13:18:58 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef V8_CODE_FACTORY_H_
|
|
|
|
#define V8_CODE_FACTORY_H_
|
|
|
|
|
|
|
|
#include "src/allocation.h"
|
|
|
|
#include "src/assembler.h"
|
|
|
|
#include "src/codegen.h"
|
|
|
|
#include "src/globals.h"
|
|
|
|
#include "src/interface-descriptors.h"
|
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
// Associates a body of code with an interface descriptor.
|
2015-04-20 13:08:11 +00:00
|
|
|
class Callable final BASE_EMBEDDED {
|
2014-09-11 13:18:58 +00:00
|
|
|
public:
|
|
|
|
Callable(Handle<Code> code, CallInterfaceDescriptor descriptor)
|
|
|
|
: code_(code), descriptor_(descriptor) {}
|
|
|
|
|
|
|
|
Handle<Code> code() const { return code_; }
|
|
|
|
CallInterfaceDescriptor descriptor() const { return descriptor_; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Handle<Code> code_;
|
|
|
|
const CallInterfaceDescriptor descriptor_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-04-20 13:08:11 +00:00
|
|
|
class CodeFactory final {
|
2014-09-11 13:18:58 +00:00
|
|
|
public:
|
|
|
|
// Initial states for ICs.
|
Revert of Revert of [strong] Implement strong mode restrictions on property access (patchset #1 id:1 of https://codereview.chromium.org/1189153002/)
Reason for revert:
Issue was ultimately caused/fixed by https://codereview.chromium.org/1194673002/
Original issue's description:
> Revert of [strong] Implement strong mode restrictions on property access (patchset #23 id:460001 of https://codereview.chromium.org/1168093002/)
>
> Reason for revert:
> Speculative revert, maybe breaks GC-stress
>
> http://build.chromium.org/p/client.v8/builders/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/builds/808
>
> Original issue's description:
> > [strong] Implement strong mode restrictions on property access
> >
> > Implements the strong mode proposal's restrictions on property access.
> >
> > To be fully explored in a followup: proxies, interceptors, access checks, load from super
> >
> > BUG=v8:3956
> > LOG=N
> >
> > Committed: https://crrev.com/85dbfb9a389e7b21bd2a63862202ee97fc5d7982
> > Cr-Commit-Position: refs/heads/master@{#29109}
>
> TBR=rossberg@chromium.org,mvstanton@chromium.org,mstarzinger@chromium.org,verwaest@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=v8:3956
>
> Committed: https://crrev.com/407657b706711fd5f8d417841e24b284886f3776
> Cr-Commit-Position: refs/heads/master@{#29115}
TBR=rossberg@chromium.org,mvstanton@chromium.org,mstarzinger@chromium.org,verwaest@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:3956
LOG=N
Review URL: https://codereview.chromium.org/1185343005
Cr-Commit-Position: refs/heads/master@{#29122}
2015-06-18 17:16:45 +00:00
|
|
|
static Callable LoadIC(Isolate* isolate, ContextualMode mode,
|
|
|
|
LanguageMode language_mode);
|
2015-02-23 12:34:07 +00:00
|
|
|
static Callable LoadICInOptimizedCode(Isolate* isolate, ContextualMode mode,
|
Revert of Revert of [strong] Implement strong mode restrictions on property access (patchset #1 id:1 of https://codereview.chromium.org/1189153002/)
Reason for revert:
Issue was ultimately caused/fixed by https://codereview.chromium.org/1194673002/
Original issue's description:
> Revert of [strong] Implement strong mode restrictions on property access (patchset #23 id:460001 of https://codereview.chromium.org/1168093002/)
>
> Reason for revert:
> Speculative revert, maybe breaks GC-stress
>
> http://build.chromium.org/p/client.v8/builders/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/builds/808
>
> Original issue's description:
> > [strong] Implement strong mode restrictions on property access
> >
> > Implements the strong mode proposal's restrictions on property access.
> >
> > To be fully explored in a followup: proxies, interceptors, access checks, load from super
> >
> > BUG=v8:3956
> > LOG=N
> >
> > Committed: https://crrev.com/85dbfb9a389e7b21bd2a63862202ee97fc5d7982
> > Cr-Commit-Position: refs/heads/master@{#29109}
>
> TBR=rossberg@chromium.org,mvstanton@chromium.org,mstarzinger@chromium.org,verwaest@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=v8:3956
>
> Committed: https://crrev.com/407657b706711fd5f8d417841e24b284886f3776
> Cr-Commit-Position: refs/heads/master@{#29115}
TBR=rossberg@chromium.org,mvstanton@chromium.org,mstarzinger@chromium.org,verwaest@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:3956
LOG=N
Review URL: https://codereview.chromium.org/1185343005
Cr-Commit-Position: refs/heads/master@{#29122}
2015-06-18 17:16:45 +00:00
|
|
|
LanguageMode language_mode,
|
2015-02-23 12:34:07 +00:00
|
|
|
InlineCacheState initialization_state);
|
Revert of Revert of [strong] Implement strong mode restrictions on property access (patchset #1 id:1 of https://codereview.chromium.org/1189153002/)
Reason for revert:
Issue was ultimately caused/fixed by https://codereview.chromium.org/1194673002/
Original issue's description:
> Revert of [strong] Implement strong mode restrictions on property access (patchset #23 id:460001 of https://codereview.chromium.org/1168093002/)
>
> Reason for revert:
> Speculative revert, maybe breaks GC-stress
>
> http://build.chromium.org/p/client.v8/builders/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/builds/808
>
> Original issue's description:
> > [strong] Implement strong mode restrictions on property access
> >
> > Implements the strong mode proposal's restrictions on property access.
> >
> > To be fully explored in a followup: proxies, interceptors, access checks, load from super
> >
> > BUG=v8:3956
> > LOG=N
> >
> > Committed: https://crrev.com/85dbfb9a389e7b21bd2a63862202ee97fc5d7982
> > Cr-Commit-Position: refs/heads/master@{#29109}
>
> TBR=rossberg@chromium.org,mvstanton@chromium.org,mstarzinger@chromium.org,verwaest@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=v8:3956
>
> Committed: https://crrev.com/407657b706711fd5f8d417841e24b284886f3776
> Cr-Commit-Position: refs/heads/master@{#29115}
TBR=rossberg@chromium.org,mvstanton@chromium.org,mstarzinger@chromium.org,verwaest@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:3956
LOG=N
Review URL: https://codereview.chromium.org/1185343005
Cr-Commit-Position: refs/heads/master@{#29122}
2015-06-18 17:16:45 +00:00
|
|
|
static Callable KeyedLoadIC(Isolate* isolate, LanguageMode language_mode);
|
2015-02-25 19:32:36 +00:00
|
|
|
static Callable KeyedLoadICInOptimizedCode(
|
Revert of Revert of [strong] Implement strong mode restrictions on property access (patchset #1 id:1 of https://codereview.chromium.org/1189153002/)
Reason for revert:
Issue was ultimately caused/fixed by https://codereview.chromium.org/1194673002/
Original issue's description:
> Revert of [strong] Implement strong mode restrictions on property access (patchset #23 id:460001 of https://codereview.chromium.org/1168093002/)
>
> Reason for revert:
> Speculative revert, maybe breaks GC-stress
>
> http://build.chromium.org/p/client.v8/builders/V8%20Linux64%20GC%20Stress%20-%20custom%20snapshot/builds/808
>
> Original issue's description:
> > [strong] Implement strong mode restrictions on property access
> >
> > Implements the strong mode proposal's restrictions on property access.
> >
> > To be fully explored in a followup: proxies, interceptors, access checks, load from super
> >
> > BUG=v8:3956
> > LOG=N
> >
> > Committed: https://crrev.com/85dbfb9a389e7b21bd2a63862202ee97fc5d7982
> > Cr-Commit-Position: refs/heads/master@{#29109}
>
> TBR=rossberg@chromium.org,mvstanton@chromium.org,mstarzinger@chromium.org,verwaest@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=v8:3956
>
> Committed: https://crrev.com/407657b706711fd5f8d417841e24b284886f3776
> Cr-Commit-Position: refs/heads/master@{#29115}
TBR=rossberg@chromium.org,mvstanton@chromium.org,mstarzinger@chromium.org,verwaest@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:3956
LOG=N
Review URL: https://codereview.chromium.org/1185343005
Cr-Commit-Position: refs/heads/master@{#29122}
2015-06-18 17:16:45 +00:00
|
|
|
Isolate* isolate, LanguageMode language_mode,
|
|
|
|
InlineCacheState initialization_state);
|
2015-01-27 11:23:51 +00:00
|
|
|
static Callable CallIC(Isolate* isolate, int argc,
|
|
|
|
CallICState::CallType call_type);
|
|
|
|
static Callable CallICInOptimizedCode(Isolate* isolate, int argc,
|
|
|
|
CallICState::CallType call_type);
|
2015-02-04 09:34:05 +00:00
|
|
|
static Callable StoreIC(Isolate* isolate, LanguageMode mode);
|
|
|
|
static Callable KeyedStoreIC(Isolate* isolate, LanguageMode mode);
|
2015-02-25 19:32:36 +00:00
|
|
|
static Callable KeyedStoreICInOptimizedCode(
|
|
|
|
Isolate* isolate, LanguageMode mode,
|
|
|
|
InlineCacheState initialization_state);
|
2014-09-11 13:18:58 +00:00
|
|
|
|
2015-05-12 15:23:53 +00:00
|
|
|
static Callable CompareIC(Isolate* isolate, Token::Value op,
|
2015-06-08 12:17:58 +00:00
|
|
|
Strength strength);
|
2014-09-11 13:18:58 +00:00
|
|
|
|
2015-04-24 12:32:56 +00:00
|
|
|
static Callable BinaryOpIC(Isolate* isolate, Token::Value op,
|
2015-06-08 12:17:58 +00:00
|
|
|
Strength strength);
|
2014-09-11 13:18:58 +00:00
|
|
|
|
|
|
|
// Code stubs. Add methods here as needed to reduce dependency on
|
|
|
|
// code-stubs.h.
|
|
|
|
static Callable ToBoolean(
|
|
|
|
Isolate* isolate, ToBooleanStub::ResultMode mode,
|
|
|
|
ToBooleanStub::Types types = ToBooleanStub::Types());
|
|
|
|
|
|
|
|
static Callable ToNumber(Isolate* isolate);
|
|
|
|
|
|
|
|
static Callable StringAdd(Isolate* isolate, StringAddFlags flags,
|
|
|
|
PretenureFlag pretenure_flag);
|
|
|
|
|
2015-05-06 13:31:00 +00:00
|
|
|
static Callable Typeof(Isolate* isolate);
|
|
|
|
|
2015-04-21 15:43:31 +00:00
|
|
|
static Callable FastCloneShallowArray(Isolate* isolate);
|
|
|
|
static Callable FastCloneShallowObject(Isolate* isolate, int length);
|
|
|
|
|
2015-04-27 09:08:20 +00:00
|
|
|
static Callable FastNewClosure(Isolate* isolate, LanguageMode language_mode,
|
|
|
|
FunctionKind kind);
|
|
|
|
|
2014-11-04 12:58:17 +00:00
|
|
|
static Callable AllocateHeapNumber(Isolate* isolate);
|
|
|
|
|
2014-09-11 13:18:58 +00:00
|
|
|
static Callable CallFunction(Isolate* isolate, int argc,
|
|
|
|
CallFunctionFlags flags);
|
|
|
|
};
|
2014-11-04 12:58:17 +00:00
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
2014-09-11 13:18:58 +00:00
|
|
|
#endif // V8_CODE_FACTORY_H_
|