Get rid of CodeStub::TryGetCode.
This function is no longer needed. It was only used (overly defensively) when fetching the stack check stub for on-stack replacement patching. R=vegorov@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/8510013 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9942 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
3bb1da0ff0
commit
cefa4cc148
@ -585,13 +585,6 @@ class RecordWriteStub: public CodeStub {
|
|||||||
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
|
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MustBeInStubCache() {
|
|
||||||
// All stubs must be registered in the stub cache
|
|
||||||
// otherwise IncrementalMarker would not be able to find
|
|
||||||
// and patch it.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activate(Code* code) {
|
void Activate(Code* code) {
|
||||||
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
|
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
|
||||||
}
|
}
|
||||||
|
@ -139,47 +139,6 @@ Handle<Code> CodeStub::GetCode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MaybeObject* CodeStub::TryGetCode() {
|
|
||||||
Code* code;
|
|
||||||
if (!FindCodeInCache(&code)) {
|
|
||||||
// Generate the new code.
|
|
||||||
MacroAssembler masm(Isolate::Current(), NULL, 256);
|
|
||||||
GenerateCode(&masm);
|
|
||||||
Heap* heap = masm.isolate()->heap();
|
|
||||||
|
|
||||||
// Create the code object.
|
|
||||||
CodeDesc desc;
|
|
||||||
masm.GetCode(&desc);
|
|
||||||
|
|
||||||
// Try to copy the generated code into a heap object.
|
|
||||||
Code::Flags flags = Code::ComputeFlags(
|
|
||||||
static_cast<Code::Kind>(GetCodeKind()),
|
|
||||||
GetICState());
|
|
||||||
Object* new_object;
|
|
||||||
{ MaybeObject* maybe_new_object =
|
|
||||||
heap->CreateCode(desc, flags, masm.CodeObject());
|
|
||||||
if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object;
|
|
||||||
}
|
|
||||||
code = Code::cast(new_object);
|
|
||||||
RecordCodeGeneration(code, &masm);
|
|
||||||
FinishCode(code);
|
|
||||||
|
|
||||||
// Try to update the code cache but do not fail if unable.
|
|
||||||
MaybeObject* maybe_new_object =
|
|
||||||
heap->code_stubs()->AtNumberPut(GetKey(), code);
|
|
||||||
if (maybe_new_object->ToObject(&new_object)) {
|
|
||||||
heap->public_set_code_stubs(NumberDictionary::cast(new_object));
|
|
||||||
} else if (MustBeInStubCache()) {
|
|
||||||
return maybe_new_object;
|
|
||||||
}
|
|
||||||
|
|
||||||
Activate(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const char* CodeStub::MajorName(CodeStub::Major major_key,
|
const char* CodeStub::MajorName(CodeStub::Major major_key,
|
||||||
bool allow_unknown_keys) {
|
bool allow_unknown_keys) {
|
||||||
switch (major_key) {
|
switch (major_key) {
|
||||||
|
@ -118,11 +118,6 @@ class CodeStub BASE_EMBEDDED {
|
|||||||
// Retrieve the code for the stub. Generate the code if needed.
|
// Retrieve the code for the stub. Generate the code if needed.
|
||||||
Handle<Code> GetCode();
|
Handle<Code> GetCode();
|
||||||
|
|
||||||
// Retrieve the code for the stub if already generated. Do not
|
|
||||||
// generate the code if not already generated and instead return a
|
|
||||||
// retry after GC Failure object.
|
|
||||||
MUST_USE_RESULT MaybeObject* TryGetCode();
|
|
||||||
|
|
||||||
static Major MajorKeyFromKey(uint32_t key) {
|
static Major MajorKeyFromKey(uint32_t key) {
|
||||||
return static_cast<Major>(MajorKeyBits::decode(key));
|
return static_cast<Major>(MajorKeyBits::decode(key));
|
||||||
}
|
}
|
||||||
@ -160,14 +155,14 @@ class CodeStub BASE_EMBEDDED {
|
|||||||
// result in a traversable stack.
|
// result in a traversable stack.
|
||||||
virtual bool SometimesSetsUpAFrame() { return true; }
|
virtual bool SometimesSetsUpAFrame() { return true; }
|
||||||
|
|
||||||
|
// Lookup the code in the (possibly custom) cache.
|
||||||
|
bool FindCodeInCache(Code** code_out);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const int kMajorBits = 6;
|
static const int kMajorBits = 6;
|
||||||
static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits;
|
static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Lookup the code in the (possibly custom) cache.
|
|
||||||
bool FindCodeInCache(Code** code_out);
|
|
||||||
|
|
||||||
// Nonvirtual wrapper around the stub-specific Generate function. Call
|
// Nonvirtual wrapper around the stub-specific Generate function. Call
|
||||||
// this function to set up the macro assembler and generate the code.
|
// this function to set up the macro assembler and generate the code.
|
||||||
void GenerateCode(MacroAssembler* masm);
|
void GenerateCode(MacroAssembler* masm);
|
||||||
@ -182,10 +177,6 @@ class CodeStub BASE_EMBEDDED {
|
|||||||
// Finish the code object after it has been generated.
|
// Finish the code object after it has been generated.
|
||||||
virtual void FinishCode(Code* code) { }
|
virtual void FinishCode(Code* code) { }
|
||||||
|
|
||||||
// Returns true if TryGetCode should fail if it failed
|
|
||||||
// to register newly generated stub in the stub cache.
|
|
||||||
virtual bool MustBeInStubCache() { return false; }
|
|
||||||
|
|
||||||
// Activate newly generated stub. Is called after
|
// Activate newly generated stub. Is called after
|
||||||
// registering stub in the stub cache.
|
// registering stub in the stub cache.
|
||||||
virtual void Activate(Code* code) { }
|
virtual void Activate(Code* code) { }
|
||||||
|
@ -711,13 +711,6 @@ class RecordWriteStub: public CodeStub {
|
|||||||
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
|
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MustBeInStubCache() {
|
|
||||||
// All stubs must be registered in the stub cache
|
|
||||||
// otherwise IncrementalMarker would not be able to find
|
|
||||||
// and patch it.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activate(Code* code) {
|
void Activate(Code* code) {
|
||||||
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
|
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
|
||||||
}
|
}
|
||||||
|
@ -586,13 +586,6 @@ class RecordWriteStub: public CodeStub {
|
|||||||
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
|
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MustBeInStubCache() {
|
|
||||||
// All stubs must be registered in the stub cache
|
|
||||||
// otherwise IncrementalMarker would not be able to find
|
|
||||||
// and patch it.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activate(Code* code) {
|
void Activate(Code* code) {
|
||||||
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
|
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
|
||||||
}
|
}
|
||||||
|
@ -136,14 +136,13 @@ void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) {
|
|||||||
// Get the stack check stub code object to match against. We aren't
|
// Get the stack check stub code object to match against. We aren't
|
||||||
// prepared to generate it, but we don't expect to have to.
|
// prepared to generate it, but we don't expect to have to.
|
||||||
StackCheckStub check_stub;
|
StackCheckStub check_stub;
|
||||||
Object* check_code;
|
Code* stack_check_code = NULL;
|
||||||
MaybeObject* maybe_check_code = check_stub.TryGetCode();
|
if (check_stub.FindCodeInCache(&stack_check_code)) {
|
||||||
if (maybe_check_code->ToObject(&check_code)) {
|
|
||||||
Code* replacement_code =
|
Code* replacement_code =
|
||||||
isolate_->builtins()->builtin(Builtins::kOnStackReplacement);
|
isolate_->builtins()->builtin(Builtins::kOnStackReplacement);
|
||||||
Code* unoptimized_code = shared->code();
|
Code* unoptimized_code = shared->code();
|
||||||
Deoptimizer::PatchStackCheckCode(unoptimized_code,
|
Deoptimizer::PatchStackCheckCode(unoptimized_code,
|
||||||
Code::cast(check_code),
|
stack_check_code,
|
||||||
replacement_code);
|
replacement_code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -693,13 +693,6 @@ class RecordWriteStub: public CodeStub {
|
|||||||
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
|
SaveFPRegsModeBits::encode(save_fp_regs_mode_);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MustBeInStubCache() {
|
|
||||||
// All stubs must be registered in the stub cache
|
|
||||||
// otherwise IncrementalMarker would not be able to find
|
|
||||||
// and patch it.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activate(Code* code) {
|
void Activate(Code* code) {
|
||||||
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
|
code->GetHeap()->incremental_marking()->ActivateGeneratedStub(code);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user