summaryrefslogtreecommitdiffstats
path: root/src/code-stubs.cc
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-26 01:26:41 +0100
committerSteve Block <steveblock@google.com>2011-06-02 15:09:56 +0100
commit44f0eee88ff00398ff7f715fab053374d808c90d (patch)
treeaddd100e906cd43f843f3aaf64b445f17f46fe0f /src/code-stubs.cc
parent1b63b9ad386abd62f61af0e29246a687f5311b53 (diff)
downloadandroid_external_v8-44f0eee88ff00398ff7f715fab053374d808c90d.tar.gz
android_external_v8-44f0eee88ff00398ff7f715fab053374d808c90d.tar.bz2
android_external_v8-44f0eee88ff00398ff7f715fab053374d808c90d.zip
Update V8 to r7427: Initial merge by git
As required by WebKit r82507 Change-Id: I7ae83ef3f689356043b4929255b7c1dd31d8c5df
Diffstat (limited to 'src/code-stubs.cc')
-rw-r--r--src/code-stubs.cc40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index ba77b21c..2ecd3361 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -37,9 +37,10 @@ namespace v8 {
namespace internal {
bool CodeStub::FindCodeInCache(Code** code_out) {
- int index = Heap::code_stubs()->FindEntry(GetKey());
+ Heap* heap = Isolate::Current()->heap();
+ int index = heap->code_stubs()->FindEntry(GetKey());
if (index != NumberDictionary::kNotFound) {
- *code_out = Code::cast(Heap::code_stubs()->ValueAt(index));
+ *code_out = Code::cast(heap->code_stubs()->ValueAt(index));
return true;
}
return false;
@@ -48,7 +49,7 @@ bool CodeStub::FindCodeInCache(Code** code_out) {
void CodeStub::GenerateCode(MacroAssembler* masm) {
// Update the static counter each time a new code stub is generated.
- Counters::code_stubs.Increment();
+ masm->isolate()->counters()->code_stubs()->Increment();
// Nested stubs are not allowed for leafs.
AllowStubCallsScope allow_scope(masm, AllowsStubCalls());
@@ -62,9 +63,11 @@ void CodeStub::GenerateCode(MacroAssembler* masm) {
void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) {
code->set_major_key(MajorKey());
- PROFILE(CodeCreateEvent(Logger::STUB_TAG, code, GetName()));
+ Isolate* isolate = masm->isolate();
+ PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, GetName()));
GDBJIT(AddCode(GDBJITInterface::STUB, GetName(), code));
- Counters::total_stubs_code_size.Increment(code->instruction_size());
+ Counters* counters = isolate->counters();
+ counters->total_stubs_code_size()->Increment(code->instruction_size());
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_code_stubs) {
@@ -84,9 +87,12 @@ int CodeStub::GetCodeKind() {
Handle<Code> CodeStub::GetCode() {
+ Isolate* isolate = Isolate::Current();
+ Factory* factory = isolate->factory();
+ Heap* heap = isolate->heap();
Code* code;
if (!FindCodeInCache(&code)) {
- v8::HandleScope scope;
+ HandleScope scope(isolate);
// Generate the new code.
MacroAssembler masm(NULL, 256);
@@ -101,22 +107,24 @@ Handle<Code> CodeStub::GetCode() {
static_cast<Code::Kind>(GetCodeKind()),
InLoop(),
GetICState());
- Handle<Code> new_object = Factory::NewCode(desc, flags, masm.CodeObject());
+ Handle<Code> new_object = factory->NewCode(
+ desc, flags, masm.CodeObject(), NeedsImmovableCode());
RecordCodeGeneration(*new_object, &masm);
FinishCode(*new_object);
// Update the dictionary and the root in Heap.
Handle<NumberDictionary> dict =
- Factory::DictionaryAtNumberPut(
- Handle<NumberDictionary>(Heap::code_stubs()),
+ factory->DictionaryAtNumberPut(
+ Handle<NumberDictionary>(heap->code_stubs()),
GetKey(),
new_object);
- Heap::public_set_code_stubs(*dict);
+ heap->public_set_code_stubs(*dict);
code = *new_object;
}
- return Handle<Code>(code);
+ ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code));
+ return Handle<Code>(code, isolate);
}
@@ -126,6 +134,7 @@ MaybeObject* CodeStub::TryGetCode() {
// Generate the new code.
MacroAssembler masm(NULL, 256);
GenerateCode(&masm);
+ Heap* heap = masm.isolate()->heap();
// Create the code object.
CodeDesc desc;
@@ -138,7 +147,7 @@ MaybeObject* CodeStub::TryGetCode() {
GetICState());
Object* new_object;
{ MaybeObject* maybe_new_object =
- Heap::CreateCode(desc, flags, masm.CodeObject());
+ heap->CreateCode(desc, flags, masm.CodeObject());
if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object;
}
code = Code::cast(new_object);
@@ -147,9 +156,9 @@ MaybeObject* CodeStub::TryGetCode() {
// Try to update the code cache but do not fail if unable.
MaybeObject* maybe_new_object =
- Heap::code_stubs()->AtNumberPut(GetKey(), code);
+ heap->code_stubs()->AtNumberPut(GetKey(), code);
if (maybe_new_object->ToObject(&new_object)) {
- Heap::public_set_code_stubs(NumberDictionary::cast(new_object));
+ heap->public_set_code_stubs(NumberDictionary::cast(new_object));
}
}
@@ -200,7 +209,8 @@ void ICCompareStub::Generate(MacroAssembler* masm) {
const char* InstanceofStub::GetName() {
if (name_ != NULL) return name_;
const int kMaxNameLength = 100;
- name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength);
+ name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
+ kMaxNameLength);
if (name_ == NULL) return "OOM";
const char* args = "";