| Index: src/code-stubs.h
|
| diff --git a/src/code-stubs.h b/src/code-stubs.h
|
| index 34da148e5d1a9d8ca6f3603d8eee025e15b5b865..d9c337d744e6666d530bc275042b0be3dd00f1d6 100644
|
| --- a/src/code-stubs.h
|
| +++ b/src/code-stubs.h
|
| @@ -38,6 +38,7 @@ namespace internal {
|
| // List of code stubs used on all platforms.
|
| #define CODE_STUB_LIST_ALL_PLATFORMS(V) \
|
| V(CallFunction) \
|
| + V(CallConstruct) \
|
| V(UnaryOp) \
|
| V(BinaryOp) \
|
| V(StringAdd) \
|
| @@ -731,21 +732,19 @@ class RegExpConstructResultStub: public CodeStub {
|
| };
|
|
|
|
|
| -class CallFunctionStub: public CodeStub {
|
| +// Base class for call stubs caching call targets in the instruction stream.
|
| +class CallStub: public CodeStub {
|
| public:
|
| - CallFunctionStub(int argc, CallFunctionFlags flags)
|
| - : argc_(argc), flags_(flags) { }
|
| -
|
| - void Generate(MacroAssembler* masm);
|
| -
|
| - virtual void FinishCode(Handle<Code> code);
|
| -
|
| static void Clear(Heap* heap, Address address);
|
|
|
| static Object* GetCachedValue(Address address);
|
|
|
| - static int ExtractArgcFromMinorKey(int minor_key) {
|
| - return ArgcBits::decode(minor_key);
|
| + // Checks whether a call to the given target has a cache attached.
|
| + static bool HasCache(Code* target) {
|
| + return target->kind() == Code::STUB &&
|
| + (target->major_key() == CallFunction ||
|
| + target->major_key() == CallConstruct) &&
|
| + target->has_function_cache();
|
| }
|
|
|
| // The object that indicates an uninitialized cache.
|
| @@ -764,6 +763,24 @@ class CallFunctionStub: public CodeStub {
|
| return isolate->factory()->undefined_value();
|
| }
|
|
|
| + protected:
|
| + void GenerateRecordCallTarget(MacroAssembler* masm);
|
| +};
|
| +
|
| +
|
| +class CallFunctionStub: public CallStub {
|
| + public:
|
| + CallFunctionStub(int argc, CallFunctionFlags flags)
|
| + : argc_(argc), flags_(flags) { }
|
| +
|
| + void Generate(MacroAssembler* masm);
|
| +
|
| + virtual void FinishCode(Handle<Code> code);
|
| +
|
| + static int ExtractArgcFromMinorKey(int minor_key) {
|
| + return ArgcBits::decode(minor_key);
|
| + }
|
| +
|
| private:
|
| int argc_;
|
| CallFunctionFlags flags_;
|
| @@ -790,6 +807,26 @@ class CallFunctionStub: public CodeStub {
|
| };
|
|
|
|
|
| +class CallConstructStub: public CallStub {
|
| + public:
|
| + explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {}
|
| +
|
| + void Generate(MacroAssembler* masm);
|
| +
|
| + virtual void FinishCode(Handle<Code> code);
|
| +
|
| + private:
|
| + CallFunctionFlags flags_;
|
| +
|
| + Major MajorKey() { return CallConstruct; }
|
| + int MinorKey() { return flags_; }
|
| +
|
| + bool RecordCallTarget() {
|
| + return (flags_ & RECORD_CALL_TARGET) != 0;
|
| + }
|
| +};
|
| +
|
| +
|
| enum StringIndexFlags {
|
| // Accepts smis or heap numbers.
|
| STRING_INDEX_IS_NUMBER,
|
|
|