Avoid TLS access for counters.

Get rid of the COUNTERS macro and fetch the counters from a locally
stored isolate instead.

R=karlklose@chromium.org

Review URL: http://codereview.chromium.org/6723014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7321 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ager@chromium.org 2011-03-23 11:13:07 +00:00
parent 6945a1241a
commit 4f5de28a9b
33 changed files with 494 additions and 354 deletions

View File

@ -310,6 +310,7 @@ static void AllocateJSArray(MacroAssembler* masm,
// construct call and normal call.
static void ArrayNativeCode(MacroAssembler* masm,
Label* call_generic_code) {
Counters* counters = masm->isolate()->counters();
Label argc_one_or_more, argc_two_or_more;
// Check for array construction with zero arguments or one.
@ -325,7 +326,7 @@ static void ArrayNativeCode(MacroAssembler* masm,
r5,
JSArray::kPreallocatedArrayElements,
call_generic_code);
__ IncrementCounter(COUNTERS->array_function_native(), 1, r3, r4);
__ IncrementCounter(counters->array_function_native(), 1, r3, r4);
// Setup return value, remove receiver from stack and return.
__ mov(r0, r2);
__ add(sp, sp, Operand(kPointerSize));
@ -361,7 +362,7 @@ static void ArrayNativeCode(MacroAssembler* masm,
r7,
true,
call_generic_code);
__ IncrementCounter(COUNTERS->array_function_native(), 1, r2, r4);
__ IncrementCounter(counters->array_function_native(), 1, r2, r4);
// Setup return value, remove receiver and argument from stack and return.
__ mov(r0, r3);
__ add(sp, sp, Operand(2 * kPointerSize));
@ -385,7 +386,7 @@ static void ArrayNativeCode(MacroAssembler* masm,
r7,
false,
call_generic_code);
__ IncrementCounter(COUNTERS->array_function_native(), 1, r2, r6);
__ IncrementCounter(counters->array_function_native(), 1, r2, r6);
// Fill arguments as array elements. Copy from the top of the stack (last
// element) to the array backing store filling it backwards. Note:
@ -490,7 +491,8 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
// -- sp[(argc - n - 1) * 4] : arg[n] (zero based)
// -- sp[argc * 4] : receiver
// -----------------------------------
__ IncrementCounter(COUNTERS->string_ctor_calls(), 1, r2, r3);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->string_ctor_calls(), 1, r2, r3);
Register function = r1;
if (FLAG_debug_code) {
@ -520,7 +522,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
r5, // Scratch.
false, // Is it a Smi?
&not_cached);
__ IncrementCounter(COUNTERS->string_ctor_cached_number(), 1, r3, r4);
__ IncrementCounter(counters->string_ctor_cached_number(), 1, r3, r4);
__ bind(&argument_is_string);
// ----------- S t a t e -------------
@ -574,13 +576,13 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
__ tst(r3, Operand(kIsNotStringMask));
__ b(ne, &convert_argument);
__ mov(argument, r0);
__ IncrementCounter(COUNTERS->string_ctor_conversions(), 1, r3, r4);
__ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4);
__ b(&argument_is_string);
// Invoke the conversion builtin and put the result into r2.
__ bind(&convert_argument);
__ push(function); // Preserve the function.
__ IncrementCounter(COUNTERS->string_ctor_conversions(), 1, r3, r4);
__ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4);
__ EnterInternalFrame();
__ push(r0);
__ InvokeBuiltin(Builtins::TO_STRING, CALL_JS);
@ -599,7 +601,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
// At this point the argument is already a string. Call runtime to
// create a string wrapper.
__ bind(&gc_required);
__ IncrementCounter(COUNTERS->string_ctor_gc_required(), 1, r3, r4);
__ IncrementCounter(counters->string_ctor_gc_required(), 1, r3, r4);
__ EnterInternalFrame();
__ push(argument);
__ CallRuntime(Runtime::kNewStringWrapper, 1);
@ -646,6 +648,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
// Should never count constructions for api objects.
ASSERT(!is_api_function || !count_constructions);
Isolate* isolate = masm->isolate();
// Enter a construct frame.
__ EnterConstructFrame();
@ -661,7 +665,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
Label undo_allocation;
#ifdef ENABLE_DEBUGGER_SUPPORT
ExternalReference debug_step_in_fp =
ExternalReference::debug_step_in_fp_address(masm->isolate());
ExternalReference::debug_step_in_fp_address(isolate);
__ mov(r2, Operand(debug_step_in_fp));
__ ldr(r2, MemOperand(r2));
__ tst(r2, r2);
@ -908,8 +912,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
if (is_api_function) {
__ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
Handle<Code> code = Handle<Code>(
masm->isolate()->builtins()->builtin(
Builtins::HandleApiCallConstruct));
isolate->builtins()->builtin(Builtins::HandleApiCallConstruct));
ParameterCount expected(0);
__ InvokeCode(code, expected, expected,
RelocInfo::CODE_TARGET, CALL_FUNCTION);
@ -966,7 +969,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ LeaveConstructFrame();
__ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1));
__ add(sp, sp, Operand(kPointerSize));
__ IncrementCounter(COUNTERS->constructed_objects(), 1, r1, r2);
__ IncrementCounter(isolate->counters()->constructed_objects(), 1, r1, r2);
__ Jump(lr);
}

View File

@ -1458,11 +1458,12 @@ void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm,
// number string cache for smis is just the smi value, and the hash for
// doubles is the xor of the upper and lower words. See
// Heap::GetNumberStringCache.
Isolate* isolate = masm->isolate();
Label is_smi;
Label load_result_from_cache;
if (!object_is_smi) {
__ JumpIfSmi(object, &is_smi);
if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) {
if (isolate->cpu_features()->IsSupported(VFP3)) {
CpuFeatures::Scope scope(VFP3);
__ CheckMap(object,
scratch1,
@ -1519,7 +1520,7 @@ void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm,
__ bind(&load_result_from_cache);
__ ldr(result,
FieldMemOperand(scratch, FixedArray::kHeaderSize + kPointerSize));
__ IncrementCounter(COUNTERS->number_to_string_native(),
__ IncrementCounter(isolate->counters()->number_to_string_native(),
1,
scratch1,
scratch2);
@ -1595,7 +1596,8 @@ void CompareStub::Generate(MacroAssembler* masm) {
__ bind(&both_loaded_as_doubles);
// The arguments have been converted to doubles and stored in d6 and d7, if
// VFP3 is supported, or in r0, r1, r2, and r3.
if (Isolate::Current()->cpu_features()->IsSupported(VFP3)) {
Isolate* isolate = masm->isolate();
if (isolate->cpu_features()->IsSupported(VFP3)) {
__ bind(&lhs_not_nan);
CpuFeatures::Scope scope(VFP3);
Label no_nan;
@ -1665,7 +1667,7 @@ void CompareStub::Generate(MacroAssembler* masm) {
__ JumpIfNonSmisNotBothSequentialAsciiStrings(lhs_, rhs_, r2, r3, &slow);
__ IncrementCounter(COUNTERS->string_compare_native(), 1, r2, r3);
__ IncrementCounter(isolate->counters()->string_compare_native(), 1, r2, r3);
StringCompareStub::GenerateCompareFlatAsciiStrings(masm,
lhs_,
rhs_,
@ -5089,7 +5091,7 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
// subject: Subject string
// regexp_data: RegExp data (FixedArray)
// All checks done. Now push arguments for native regexp code.
__ IncrementCounter(COUNTERS->regexp_entry_native(), 1, r0, r2);
__ IncrementCounter(isolate->counters()->regexp_entry_native(), 1, r0, r2);
// Isolates: note we add an additional parameter here (isolate pointer).
static const int kRegExpExecuteArguments = 8;
@ -6105,7 +6107,6 @@ void SubStringStub::Generate(MacroAssembler* masm) {
static const int kFromOffset = 1 * kPointerSize;
static const int kStringOffset = 2 * kPointerSize;
// Check bounds and smi-ness.
Register to = r6;
Register from = r7;
@ -6206,7 +6207,8 @@ void SubStringStub::Generate(MacroAssembler* masm) {
Label make_two_character_string;
StringHelper::GenerateTwoCharacterSymbolTableProbe(
masm, r3, r4, r1, r5, r6, r7, r9, &make_two_character_string);
__ IncrementCounter(COUNTERS->sub_string_native(), 1, r3, r4);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->sub_string_native(), 1, r3, r4);
__ add(sp, sp, Operand(3 * kPointerSize));
__ Ret();
@ -6215,7 +6217,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
__ bind(&make_two_character_string);
__ AllocateAsciiString(r0, r2, r4, r5, r9, &runtime);
__ strh(r3, FieldMemOperand(r0, SeqAsciiString::kHeaderSize));
__ IncrementCounter(COUNTERS->sub_string_native(), 1, r3, r4);
__ IncrementCounter(counters->sub_string_native(), 1, r3, r4);
__ add(sp, sp, Operand(3 * kPointerSize));
__ Ret();
@ -6241,7 +6243,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
STATIC_ASSERT((SeqAsciiString::kHeaderSize & kObjectAlignmentMask) == 0);
StringHelper::GenerateCopyCharactersLong(masm, r1, r5, r2, r3, r4, r6, r7, r9,
COPY_ASCII | DEST_ALWAYS_ALIGNED);
__ IncrementCounter(COUNTERS->sub_string_native(), 1, r3, r4);
__ IncrementCounter(counters->sub_string_native(), 1, r3, r4);
__ add(sp, sp, Operand(3 * kPointerSize));
__ Ret();
@ -6273,7 +6275,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
STATIC_ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0);
StringHelper::GenerateCopyCharactersLong(
masm, r1, r5, r2, r3, r4, r6, r7, r9, DEST_ALWAYS_ALIGNED);
__ IncrementCounter(COUNTERS->sub_string_native(), 1, r3, r4);
__ IncrementCounter(counters->sub_string_native(), 1, r3, r4);
__ add(sp, sp, Operand(3 * kPointerSize));
__ Ret();
@ -6345,6 +6347,8 @@ void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
void StringCompareStub::Generate(MacroAssembler* masm) {
Label runtime;
Counters* counters = masm->isolate()->counters();
// Stack frame on entry.
// sp[0]: right string
// sp[4]: left string
@ -6356,7 +6360,7 @@ void StringCompareStub::Generate(MacroAssembler* masm) {
STATIC_ASSERT(EQUAL == 0);
STATIC_ASSERT(kSmiTag == 0);
__ mov(r0, Operand(Smi::FromInt(EQUAL)));
__ IncrementCounter(COUNTERS->string_compare_native(), 1, r1, r2);
__ IncrementCounter(counters->string_compare_native(), 1, r1, r2);
__ add(sp, sp, Operand(2 * kPointerSize));
__ Ret();
@ -6366,7 +6370,7 @@ void StringCompareStub::Generate(MacroAssembler* masm) {
__ JumpIfNotBothSequentialAsciiStrings(r1, r0, r2, r3, &runtime);
// Compare flat ASCII strings natively. Remove arguments from stack first.
__ IncrementCounter(COUNTERS->string_compare_native(), 1, r2, r3);
__ IncrementCounter(counters->string_compare_native(), 1, r2, r3);
__ add(sp, sp, Operand(2 * kPointerSize));
GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5);
@ -6381,6 +6385,8 @@ void StringAddStub::Generate(MacroAssembler* masm) {
Label string_add_runtime, call_builtin;
Builtins::JavaScript builtin_id = Builtins::ADD;
Counters* counters = masm->isolate()->counters();
// Stack on entry:
// sp[0]: second argument (right).
// sp[4]: first argument (left).
@ -6436,7 +6442,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ cmp(r3, Operand(Smi::FromInt(0)), ne);
__ b(ne, &strings_not_empty); // If either string was empty, return r0.
__ IncrementCounter(COUNTERS->string_add_native(), 1, r2, r3);
__ IncrementCounter(counters->string_add_native(), 1, r2, r3);
__ add(sp, sp, Operand(2 * kPointerSize));
__ Ret();
@ -6481,7 +6487,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
Label make_two_character_string;
StringHelper::GenerateTwoCharacterSymbolTableProbe(
masm, r2, r3, r6, r7, r4, r5, r9, &make_two_character_string);
__ IncrementCounter(COUNTERS->string_add_native(), 1, r2, r3);
__ IncrementCounter(counters->string_add_native(), 1, r2, r3);
__ add(sp, sp, Operand(2 * kPointerSize));
__ Ret();
@ -6494,7 +6500,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ mov(r6, Operand(2));
__ AllocateAsciiString(r0, r6, r4, r5, r9, &string_add_runtime);
__ strh(r2, FieldMemOperand(r0, SeqAsciiString::kHeaderSize));
__ IncrementCounter(COUNTERS->string_add_native(), 1, r2, r3);
__ IncrementCounter(counters->string_add_native(), 1, r2, r3);
__ add(sp, sp, Operand(2 * kPointerSize));
__ Ret();
@ -6531,7 +6537,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ str(r0, FieldMemOperand(r7, ConsString::kFirstOffset));
__ str(r1, FieldMemOperand(r7, ConsString::kSecondOffset));
__ mov(r0, Operand(r7));
__ IncrementCounter(COUNTERS->string_add_native(), 1, r2, r3);
__ IncrementCounter(counters->string_add_native(), 1, r2, r3);
__ add(sp, sp, Operand(2 * kPointerSize));
__ Ret();
@ -6613,7 +6619,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
// r7: result string.
StringHelper::GenerateCopyCharacters(masm, r6, r1, r3, r4, true);
__ mov(r0, Operand(r7));
__ IncrementCounter(COUNTERS->string_add_native(), 1, r2, r3);
__ IncrementCounter(counters->string_add_native(), 1, r2, r3);
__ add(sp, sp, Operand(2 * kPointerSize));
__ Ret();
@ -6654,7 +6660,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
StringHelper::GenerateCopyCharacters(masm, r6, r1, r3, r4, false);
__ mov(r0, Operand(r7));
__ IncrementCounter(COUNTERS->string_add_native(), 1, r2, r3);
__ IncrementCounter(counters->string_add_native(), 1, r2, r3);
__ add(sp, sp, Operand(2 * kPointerSize));
__ Ret();

View File

@ -3699,7 +3699,8 @@ void CodeGenerator::VisitArrayLiteral(ArrayLiteral* node) {
FastCloneShallowArrayStub stub(
FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length);
frame_->CallStub(&stub, 3);
__ IncrementCounter(COUNTERS->cow_arrays_created_stub(), 1, r1, r2);
__ IncrementCounter(masm_->isolate()->counters()->cow_arrays_created_stub(),
1, r1, r2);
} else if (node->depth() > 1) {
frame_->CallRuntime(Runtime::kCreateArrayLiteral, 3);
} else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
@ -6588,9 +6589,10 @@ void DeferredReferenceGetNamedValue::Generate() {
Register scratch1 = VirtualFrame::scratch0();
Register scratch2 = VirtualFrame::scratch1();
ASSERT(!receiver_.is(scratch1) && !receiver_.is(scratch2));
__ DecrementCounter(COUNTERS->named_load_inline(), 1, scratch1, scratch2);
__ IncrementCounter(COUNTERS->named_load_inline_miss(), 1,
scratch1, scratch2);
__ DecrementCounter(masm_->isolate()->counters()->named_load_inline(),
1, scratch1, scratch2);
__ IncrementCounter(masm_->isolate()->counters()->named_load_inline_miss(),
1, scratch1, scratch2);
// Ensure receiver in r0 and name in r2 to match load ic calling convention.
__ Move(r0, receiver_);
@ -6661,9 +6663,10 @@ void DeferredReferenceGetKeyedValue::Generate() {
Register scratch1 = VirtualFrame::scratch0();
Register scratch2 = VirtualFrame::scratch1();
__ DecrementCounter(COUNTERS->keyed_load_inline(), 1, scratch1, scratch2);
__ IncrementCounter(COUNTERS->keyed_load_inline_miss(),
1, scratch1, scratch2);
__ DecrementCounter(masm_->isolate()->counters()->keyed_load_inline(),
1, scratch1, scratch2);
__ IncrementCounter(masm_->isolate()->counters()->keyed_load_inline_miss(),
1, scratch1, scratch2);
// Ensure key in r0 and receiver in r1 to match keyed load ic calling
// convention.
@ -6722,8 +6725,9 @@ class DeferredReferenceSetKeyedValue: public DeferredCode {
void DeferredReferenceSetKeyedValue::Generate() {
Register scratch1 = VirtualFrame::scratch0();
Register scratch2 = VirtualFrame::scratch1();
__ DecrementCounter(COUNTERS->keyed_store_inline(), 1, scratch1, scratch2);
__ IncrementCounter(COUNTERS->keyed_store_inline_miss(),
__ DecrementCounter(masm_->isolate()->counters()->keyed_store_inline(),
1, scratch1, scratch2);
__ IncrementCounter(masm_->isolate()->counters()->keyed_store_inline_miss(),
1, scratch1, scratch2);
// Ensure value in r0, key in r1 and receiver in r2 to match keyed store ic
@ -6840,11 +6844,12 @@ void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
// Counter will be decremented in the deferred code. Placed here to avoid
// having it in the instruction stream below where patching will occur.
if (is_contextual) {
__ IncrementCounter(COUNTERS->named_load_global_inline(), 1,
frame_->scratch0(), frame_->scratch1());
__ IncrementCounter(
masm_->isolate()->counters()->named_load_global_inline(),
1, frame_->scratch0(), frame_->scratch1());
} else {
__ IncrementCounter(COUNTERS->named_load_inline(), 1,
frame_->scratch0(), frame_->scratch1());
__ IncrementCounter(masm_->isolate()->counters()->named_load_inline(),
1, frame_->scratch0(), frame_->scratch1());
}
// The following instructions are the inlined load of an in-object property.
@ -6876,8 +6881,9 @@ void CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
}
}
if (is_dont_delete) {
__ IncrementCounter(COUNTERS->dont_delete_hint_hit(), 1,
frame_->scratch0(), frame_->scratch1());
__ IncrementCounter(
masm_->isolate()->counters()->dont_delete_hint_hit(),
1, frame_->scratch0(), frame_->scratch1());
}
}
@ -7062,8 +7068,8 @@ void CodeGenerator::EmitKeyedLoad() {
// Counter will be decremented in the deferred code. Placed here to avoid
// having it in the instruction stream below where patching will occur.
__ IncrementCounter(COUNTERS->keyed_load_inline(), 1,
frame_->scratch0(), frame_->scratch1());
__ IncrementCounter(masm_->isolate()->counters()->keyed_load_inline(),
1, frame_->scratch0(), frame_->scratch1());
// Load the key and receiver from the stack.
bool key_is_known_smi = frame_->KnownSmiAt(0);
@ -7149,8 +7155,8 @@ void CodeGenerator::EmitKeyedStore(StaticType* key_type,
// Counter will be decremented in the deferred code. Placed here to avoid
// having it in the instruction stream below where patching will occur.
__ IncrementCounter(COUNTERS->keyed_store_inline(), 1,
scratch1, scratch2);
__ IncrementCounter(masm_->isolate()->counters()->keyed_store_inline(),
1, scratch1, scratch2);
// Load the value, key and receiver from the stack.

View File

@ -4229,18 +4229,19 @@ Register FullCodeGenerator::context_register() {
void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
ASSERT(mode == RelocInfo::CODE_TARGET ||
mode == RelocInfo::CODE_TARGET_CONTEXT);
Counters* counters = isolate()->counters();
switch (ic->kind()) {
case Code::LOAD_IC:
__ IncrementCounter(COUNTERS->named_load_full(), 1, r1, r2);
__ IncrementCounter(counters->named_load_full(), 1, r1, r2);
break;
case Code::KEYED_LOAD_IC:
__ IncrementCounter(COUNTERS->keyed_load_full(), 1, r1, r2);
__ IncrementCounter(counters->keyed_load_full(), 1, r1, r2);
break;
case Code::STORE_IC:
__ IncrementCounter(COUNTERS->named_store_full(), 1, r1, r2);
__ IncrementCounter(counters->named_store_full(), 1, r1, r2);
break;
case Code::KEYED_STORE_IC:
__ IncrementCounter(COUNTERS->keyed_store_full(), 1, r1, r2);
__ IncrementCounter(counters->keyed_store_full(), 1, r1, r2);
default:
break;
}
@ -4250,18 +4251,19 @@ void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
void FullCodeGenerator::EmitCallIC(Handle<Code> ic, JumpPatchSite* patch_site) {
Counters* counters = isolate()->counters();
switch (ic->kind()) {
case Code::LOAD_IC:
__ IncrementCounter(COUNTERS->named_load_full(), 1, r1, r2);
__ IncrementCounter(counters->named_load_full(), 1, r1, r2);
break;
case Code::KEYED_LOAD_IC:
__ IncrementCounter(COUNTERS->keyed_load_full(), 1, r1, r2);
__ IncrementCounter(counters->keyed_load_full(), 1, r1, r2);
break;
case Code::STORE_IC:
__ IncrementCounter(COUNTERS->named_store_full(), 1, r1, r2);
__ IncrementCounter(counters->named_store_full(), 1, r1, r2);
break;
case Code::KEYED_STORE_IC:
__ IncrementCounter(COUNTERS->keyed_store_full(), 1, r1, r2);
__ IncrementCounter(counters->keyed_store_full(), 1, r1, r2);
default:
break;
}

View File

@ -646,11 +646,12 @@ static void GenerateCallMiss(MacroAssembler* masm, int argc, IC::UtilityId id) {
// -- r2 : name
// -- lr : return address
// -----------------------------------
Isolate* isolate = masm->isolate();
if (id == IC::kCallIC_Miss) {
__ IncrementCounter(COUNTERS->call_miss(), 1, r3, r4);
__ IncrementCounter(isolate->counters()->call_miss(), 1, r3, r4);
} else {
__ IncrementCounter(COUNTERS->keyed_call_miss(), 1, r3, r4);
__ IncrementCounter(isolate->counters()->keyed_call_miss(), 1, r3, r4);
}
// Get the receiver of the function from the stack.
@ -663,7 +664,7 @@ static void GenerateCallMiss(MacroAssembler* masm, int argc, IC::UtilityId id) {
// Call the entry.
__ mov(r0, Operand(2));
__ mov(r1, Operand(ExternalReference(IC_Utility(id), masm->isolate())));
__ mov(r1, Operand(ExternalReference(IC_Utility(id), isolate)));
CEntryStub stub(1);
__ CallStub(&stub);
@ -765,7 +766,8 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
GenerateFastArrayLoad(
masm, r1, r2, r4, r3, r0, r1, &check_number_dictionary, &slow_load);
__ IncrementCounter(COUNTERS->keyed_call_generic_smi_fast(), 1, r0, r3);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->keyed_call_generic_smi_fast(), 1, r0, r3);
__ bind(&do_call);
// receiver in r1 is not used after this point.
@ -784,13 +786,13 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ mov(r0, Operand(r2, ASR, kSmiTagSize));
// r0: untagged index
GenerateNumberDictionaryLoad(masm, &slow_load, r4, r2, r1, r0, r3, r5);
__ IncrementCounter(COUNTERS->keyed_call_generic_smi_dict(), 1, r0, r3);
__ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1, r0, r3);
__ jmp(&do_call);
__ bind(&slow_load);
// This branch is taken when calling KeyedCallIC_Miss is neither required
// nor beneficial.
__ IncrementCounter(COUNTERS->keyed_call_generic_slow_load(), 1, r0, r3);
__ IncrementCounter(counters->keyed_call_generic_slow_load(), 1, r0, r3);
__ EnterInternalFrame();
__ push(r2); // save the key
__ Push(r1, r2); // pass the receiver and the key
@ -817,11 +819,11 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ b(ne, &lookup_monomorphic_cache);
GenerateDictionaryLoad(masm, &slow_load, r0, r2, r1, r3, r4);
__ IncrementCounter(COUNTERS->keyed_call_generic_lookup_dict(), 1, r0, r3);
__ IncrementCounter(counters->keyed_call_generic_lookup_dict(), 1, r0, r3);
__ jmp(&do_call);
__ bind(&lookup_monomorphic_cache);
__ IncrementCounter(COUNTERS->keyed_call_generic_lookup_cache(), 1, r0, r3);
__ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1, r0, r3);
GenerateMonomorphicCacheProbe(masm, argc, Code::KEYED_CALL_IC);
// Fall through on miss.
@ -832,7 +834,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
// - the value loaded is not a function,
// - there is hope that the runtime will create a monomorphic call stub
// that will get fetched next time.
__ IncrementCounter(COUNTERS->keyed_call_generic_slow(), 1, r0, r3);
__ IncrementCounter(counters->keyed_call_generic_slow(), 1, r0, r3);
GenerateMiss(masm, argc);
__ bind(&index_string);
@ -911,15 +913,16 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
// -- r0 : receiver
// -- sp[0] : receiver
// -----------------------------------
Isolate* isolate = masm->isolate();
__ IncrementCounter(COUNTERS->load_miss(), 1, r3, r4);
__ IncrementCounter(isolate->counters()->load_miss(), 1, r3, r4);
__ mov(r3, r0);
__ Push(r3, r2);
// Perform tail call to the entry.
ExternalReference ref =
ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate());
ExternalReference(IC_Utility(kLoadIC_Miss), isolate);
__ TailCallExternalReference(ref, 2, 1);
}
@ -1144,13 +1147,14 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
// -- r0 : key
// -- r1 : receiver
// -----------------------------------
Isolate* isolate = masm->isolate();
__ IncrementCounter(COUNTERS->keyed_load_miss(), 1, r3, r4);
__ IncrementCounter(isolate->counters()->keyed_load_miss(), 1, r3, r4);
__ Push(r1, r0);
ExternalReference ref =
ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate);
__ TailCallExternalReference(ref, 2, 1);
}
@ -1180,6 +1184,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
Register key = r0;
Register receiver = r1;
Isolate* isolate = masm->isolate();
// Check that the key is a smi.
__ JumpIfNotSmi(key, &check_string);
__ bind(&index_smi);
@ -1197,7 +1203,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
GenerateFastArrayLoad(
masm, receiver, key, r4, r3, r2, r0, NULL, &slow);
__ IncrementCounter(COUNTERS->keyed_load_generic_smi(), 1, r2, r3);
__ IncrementCounter(isolate->counters()->keyed_load_generic_smi(), 1, r2, r3);
__ Ret();
__ bind(&check_number_dictionary);
@ -1217,7 +1223,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// Slow case, key and receiver still in r0 and r1.
__ bind(&slow);
__ IncrementCounter(COUNTERS->keyed_load_generic_slow(), 1, r2, r3);
__ IncrementCounter(isolate->counters()->keyed_load_generic_slow(),
1, r2, r3);
GenerateRuntimeGetProperty(masm);
__ bind(&check_string);
@ -1245,7 +1252,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// Load the key (consisting of map and symbol) from the cache and
// check for match.
ExternalReference cache_keys =
ExternalReference::keyed_lookup_cache_keys(masm->isolate());
ExternalReference::keyed_lookup_cache_keys(isolate);
__ mov(r4, Operand(cache_keys));
__ add(r4, r4, Operand(r3, LSL, kPointerSizeLog2 + 1));
__ ldr(r5, MemOperand(r4, kPointerSize, PostIndex)); // Move r4 to symbol.
@ -1261,7 +1268,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// r2 : receiver's map
// r3 : lookup cache index
ExternalReference cache_field_offsets =
ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate());
ExternalReference::keyed_lookup_cache_field_offsets(isolate);
__ mov(r4, Operand(cache_field_offsets));
__ ldr(r5, MemOperand(r4, r3, LSL, kPointerSizeLog2));
__ ldrb(r6, FieldMemOperand(r2, Map::kInObjectPropertiesOffset));
@ -1273,7 +1280,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
__ add(r6, r6, r5); // Index from start of object.
__ sub(r1, r1, Operand(kHeapObjectTag)); // Remove the heap tag.
__ ldr(r0, MemOperand(r1, r6, LSL, kPointerSizeLog2));
__ IncrementCounter(COUNTERS->keyed_load_generic_lookup_cache(), 1, r2, r3);
__ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(),
1, r2, r3);
__ Ret();
// Load property array property.
@ -1281,7 +1289,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
__ ldr(r1, FieldMemOperand(r1, JSObject::kPropertiesOffset));
__ add(r1, r1, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
__ ldr(r0, MemOperand(r1, r5, LSL, kPointerSizeLog2));
__ IncrementCounter(COUNTERS->keyed_load_generic_lookup_cache(), 1, r2, r3);
__ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(),
1, r2, r3);
__ Ret();
// Do a quick inline probe of the receiver's dictionary, if it
@ -1295,7 +1304,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
GenerateGlobalInstanceTypeCheck(masm, r2, &slow);
// Load the property to r0.
GenerateDictionaryLoad(masm, &slow, r3, r0, r0, r2, r4);
__ IncrementCounter(COUNTERS->keyed_load_generic_symbol(), 1, r2, r3);
__ IncrementCounter(isolate->counters()->keyed_load_generic_symbol(),
1, r2, r3);
__ Ret();
__ bind(&index_string);
@ -1625,11 +1635,13 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
GenerateStringDictionaryReceiverCheck(masm, r1, r3, r4, r5, &miss);
GenerateDictionaryStore(masm, &miss, r3, r2, r0, r4, r5);
__ IncrementCounter(COUNTERS->store_normal_hit(), 1, r4, r5);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->store_normal_hit(),
1, r4, r5);
__ Ret();
__ bind(&miss);
__ IncrementCounter(COUNTERS->store_normal_miss(), 1, r4, r5);
__ IncrementCounter(counters->store_normal_miss(), 1, r4, r5);
GenerateMiss(masm);
}

View File

@ -102,8 +102,9 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
Register scratch0,
Register scratch1) {
ASSERT(name->IsSymbol());
__ IncrementCounter(COUNTERS->negative_lookups(), 1, scratch0, scratch1);
__ IncrementCounter(COUNTERS->negative_lookups_miss(), 1, scratch0, scratch1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1);
__ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
Label done;
@ -199,7 +200,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
}
}
__ bind(&done);
__ DecrementCounter(COUNTERS->negative_lookups_miss(), 1, scratch0, scratch1);
__ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
}
@ -736,6 +737,8 @@ class CallInterceptorCompiler BASE_EMBEDDED {
ASSERT(optimization.is_constant_call());
ASSERT(!lookup->holder()->IsGlobalObject());
Counters* counters = masm->isolate()->counters();
int depth1 = kInvalidProtoDepth;
int depth2 = kInvalidProtoDepth;
bool can_do_fast_api_call = false;
@ -753,11 +756,11 @@ class CallInterceptorCompiler BASE_EMBEDDED {
(depth2 != kInvalidProtoDepth);
}
__ IncrementCounter(COUNTERS->call_const_interceptor(), 1,
__ IncrementCounter(counters->call_const_interceptor(), 1,
scratch1, scratch2);
if (can_do_fast_api_call) {
__ IncrementCounter(COUNTERS->call_const_interceptor_fast_api(), 1,
__ IncrementCounter(counters->call_const_interceptor_fast_api(), 1,
scratch1, scratch2);
ReserveSpaceForFastApiCall(masm, scratch1);
}
@ -2287,14 +2290,18 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
JSGlobalPropertyCell* cell,
JSFunction* function,
String* name) {
Isolate* isolate = masm()->isolate();
Heap* heap = isolate->heap();
Counters* counters = isolate->counters();
ASSERT(optimization.is_simple_api_call());
// Bail out if object is a global object as we don't want to
// repatch it to global receiver.
if (object->IsGlobalObject()) return HEAP->undefined_value();
if (cell != NULL) return HEAP->undefined_value();
if (object->IsGlobalObject()) return heap->undefined_value();
if (cell != NULL) return heap->undefined_value();
int depth = optimization.GetPrototypeDepthOfExpectedType(
JSObject::cast(object), holder);
if (depth == kInvalidProtoDepth) return HEAP->undefined_value();
if (depth == kInvalidProtoDepth) return heap->undefined_value();
Label miss, miss_before_stack_reserved;
@ -2308,8 +2315,8 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
__ tst(r1, Operand(kSmiTagMask));
__ b(eq, &miss_before_stack_reserved);
__ IncrementCounter(COUNTERS->call_const(), 1, r0, r3);
__ IncrementCounter(COUNTERS->call_const_fast_api(), 1, r0, r3);
__ IncrementCounter(counters->call_const(), 1, r0, r3);
__ IncrementCounter(counters->call_const_fast_api(), 1, r0, r3);
ReserveSpaceForFastApiCall(masm(), r0);
@ -2371,7 +2378,8 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
SharedFunctionInfo* function_info = function->shared();
switch (check) {
case RECEIVER_MAP_CHECK:
__ IncrementCounter(COUNTERS->call_const(), 1, r0, r3);
__ IncrementCounter(masm()->isolate()->counters()->call_const(),
1, r0, r3);
// Check that the maps haven't changed.
CheckPrototypes(JSObject::cast(object), r1, holder, r0, r3, r4, name,
@ -2558,7 +2566,8 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
__ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
// Jump to the cached code (tail call).
__ IncrementCounter(COUNTERS->call_global_inline(), 1, r3, r4);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->call_global_inline(), 1, r3, r4);
ASSERT(function->is_compiled());
Handle<Code> code(function->code());
ParameterCount expected(function->shared()->formal_parameter_count());
@ -2575,7 +2584,7 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
// Handle call cache miss.
__ bind(&miss);
__ IncrementCounter(COUNTERS->call_global_inline_miss(), 1, r1, r3);
__ IncrementCounter(counters->call_global_inline_miss(), 1, r1, r3);
MaybeObject* maybe_result = GenerateMissBranch();
if (maybe_result->IsFailure()) return maybe_result;
@ -2741,12 +2750,13 @@ MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
// Store the value in the cell.
__ str(r0, FieldMemOperand(r4, JSGlobalPropertyCell::kValueOffset));
__ IncrementCounter(COUNTERS->named_store_global_inline(), 1, r4, r3);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->named_store_global_inline(), 1, r4, r3);
__ Ret();
// Handle store cache miss.
__ bind(&miss);
__ IncrementCounter(COUNTERS->named_store_global_inline_miss(), 1, r4, r3);
__ IncrementCounter(counters->named_store_global_inline_miss(), 1, r4, r3);
Handle<Code> ic(Isolate::Current()->builtins()->builtin(
Builtins::StoreIC_Miss));
__ Jump(ic, RelocInfo::CODE_TARGET);
@ -2930,11 +2940,12 @@ MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
}
__ mov(r0, r4);
__ IncrementCounter(COUNTERS->named_load_global_stub(), 1, r1, r3);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->named_load_global_stub(), 1, r1, r3);
__ Ret();
__ bind(&miss);
__ IncrementCounter(COUNTERS->named_load_global_stub_miss(), 1, r1, r3);
__ IncrementCounter(counters->named_load_global_stub_miss(), 1, r1, r3);
GenerateLoadMiss(masm(), Code::LOAD_IC);
// Return the generated code.
@ -3079,7 +3090,9 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
// -- r1 : receiver
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_string_length(), 1, r2, r3);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_string_length(), 1, r2, r3);
// Check the key is the cached one.
__ cmp(r0, Operand(Handle<String>(name)));
@ -3087,7 +3100,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
GenerateLoadStringLength(masm(), r1, r2, r3, &miss, true);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_string_length(), 1, r2, r3);
__ DecrementCounter(counters->keyed_load_string_length(), 1, r2, r3);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
@ -3103,7 +3116,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_function_prototype(), 1, r2, r3);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_function_prototype(), 1, r2, r3);
// Check the name hasn't changed.
__ cmp(r0, Operand(Handle<String>(name)));
@ -3111,7 +3125,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
GenerateLoadFunctionPrototype(masm(), r1, r2, r3, &miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_function_prototype(), 1, r2, r3);
__ DecrementCounter(counters->keyed_load_function_prototype(), 1, r2, r3);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
return GetCode(CALLBACKS, name);
@ -3179,7 +3193,8 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_store_field(), 1, r3, r4);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_store_field(), 1, r3, r4);
// Check that the name has not changed.
__ cmp(r1, Operand(Handle<String>(name)));
@ -3195,7 +3210,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
&miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_store_field(), 1, r3, r4);
__ DecrementCounter(counters->keyed_store_field(), 1, r3, r4);
Handle<Code> ic(Isolate::Current()->builtins()->builtin(
Builtins::KeyedStoreIC_Miss));
@ -3405,8 +3420,9 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
// Remove caller arguments and receiver from the stack and return.
__ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2));
__ add(sp, sp, Operand(kPointerSize));
__ IncrementCounter(COUNTERS->constructed_objects(), 1, r1, r2);
__ IncrementCounter(COUNTERS->constructed_objects_stub(), 1, r1, r2);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->constructed_objects(), 1, r1, r2);
__ IncrementCounter(counters->constructed_objects_stub(), 1, r1, r2);
__ Jump(lr);
// Jump to the generic stub in case the specialized code cannot handle the
@ -3696,7 +3712,9 @@ MaybeObject* ExternalArrayStubCompiler::CompileKeyedLoadStub(
// Slow case, key and receiver still in r0 and r1.
__ bind(&slow);
__ IncrementCounter(COUNTERS->keyed_load_external_array_slow(), 1, r2, r3);
__ IncrementCounter(
masm()->isolate()->counters()->keyed_load_external_array_slow(),
1, r2, r3);
// ---------- S t a t e --------------
// -- lr : return address

View File

@ -217,7 +217,6 @@ void RelocInfoWriter::Write(const RelocInfo* rinfo) {
#ifdef DEBUG
byte* begin_pos = pos_;
#endif
COUNTERS->reloc_info_count()->Increment();
ASSERT(rinfo->pc() - last_pc_ >= 0);
ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes);
// Use unsigned delta-encoding for pc.

View File

@ -48,7 +48,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 +62,11 @@ void CodeStub::GenerateCode(MacroAssembler* masm) {
void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) {
code->set_major_key(MajorKey());
PROFILE(ISOLATE, 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) {

View File

@ -175,13 +175,17 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info) {
Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
Code::Flags flags,
CompilationInfo* info) {
Isolate* isolate = info->isolate();
// Allocate and install the code.
CodeDesc desc;
masm->GetCode(&desc);
Handle<Code> code = FACTORY->NewCode(desc, flags, masm->CodeObject());
Handle<Code> code =
isolate->factory()->NewCode(desc, flags, masm->CodeObject());
if (!code.is_null()) {
COUNTERS->total_compiled_code_size()->Increment(code->instruction_size());
isolate->counters()->total_compiled_code_size()->Increment(
code->instruction_size());
}
return code;
}
@ -235,7 +239,8 @@ bool CodeGenerator::MakeCode(CompilationInfo* info) {
Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
int len = String::cast(script->source())->length();
COUNTERS->total_old_codegen_source_size()->Increment(len);
Counters* counters = info->isolate()->counters();
counters->total_old_codegen_source_size()->Increment(len);
}
if (FLAG_trace_codegen) {
PrintF("Classic Compiler - ");

View File

@ -409,8 +409,8 @@ static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) {
// rest of the function into account to avoid overlap with the
// parsing statistics.
HistogramTimer* rate = info->is_eval()
? COUNTERS->compile_eval()
: COUNTERS->compile();
? info->isolate()->counters()->compile_eval()
: info->isolate()->counters()->compile();
HistogramTimerScope timer(rate);
// Compile the code.
@ -480,10 +480,10 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
ScriptDataImpl* input_pre_data,
Handle<Object> script_data,
NativesFlag natives) {
Isolate* isolate = Isolate::Current();
Isolate* isolate = source->GetIsolate();
int source_length = source->length();
COUNTERS->total_load_size()->Increment(source_length);
COUNTERS->total_compile_size()->Increment(source_length);
isolate->counters()->total_load_size()->Increment(source_length);
isolate->counters()->total_compile_size()->Increment(source_length);
// The VM is in the COMPILER state until exiting this function.
VMState state(isolate, COMPILER);

View File

@ -1147,14 +1147,14 @@ Code* PcToCodeCache::GcSafeFindCodeForPc(Address pc) {
PcToCodeCache::PcToCodeCacheEntry* PcToCodeCache::GetCacheEntry(Address pc) {
COUNTERS->pc_to_code()->Increment();
isolate_->counters()->pc_to_code()->Increment();
ASSERT(IsPowerOf2(kPcToCodeCacheSize));
uint32_t hash = ComputeIntegerHash(
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(pc)));
uint32_t index = hash & (kPcToCodeCacheSize - 1);
PcToCodeCacheEntry* entry = cache(index);
if (entry->pc == pc) {
COUNTERS->pc_to_code_cached()->Increment();
isolate_->counters()->pc_to_code_cached()->Increment();
ASSERT(entry->code == GcSafeFindCodeForPc(pc));
} else {
// Because this code may be interrupted by a profiling signal that

View File

@ -368,8 +368,6 @@ void Assembler::GetCode(CodeDesc* desc) {
desc->instr_size = pc_offset();
desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos();
desc->origin = this;
COUNTERS->reloc_info_size()->Increment(desc->reloc_size);
}

View File

@ -376,7 +376,7 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ pop(ecx);
__ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); // 1 ~ receiver
__ push(ecx);
__ IncrementCounter(COUNTERS->constructed_objects(), 1);
__ IncrementCounter(masm->isolate()->counters()->constructed_objects(), 1);
__ ret(0);
}
@ -1065,7 +1065,7 @@ static void ArrayNativeCode(MacroAssembler* masm,
edi,
kPreallocatedArrayElements,
&prepare_generic_code_call);
__ IncrementCounter(COUNTERS->array_function_native(), 1);
__ IncrementCounter(masm->isolate()->counters()->array_function_native(), 1);
__ pop(ebx);
if (construct_call) {
__ pop(edi);
@ -1121,7 +1121,8 @@ static void ArrayNativeCode(MacroAssembler* masm,
edi,
true,
&prepare_generic_code_call);
__ IncrementCounter(COUNTERS->array_function_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->array_function_native(), 1);
__ mov(eax, ebx);
__ pop(ebx);
if (construct_call) {
@ -1148,7 +1149,7 @@ static void ArrayNativeCode(MacroAssembler* masm,
edi,
false,
&prepare_generic_code_call);
__ IncrementCounter(COUNTERS->array_function_native(), 1);
__ IncrementCounter(counters->array_function_native(), 1);
__ mov(eax, ebx);
__ pop(ebx);
if (construct_call) {
@ -1283,7 +1284,8 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
// -- esp[(argc + 1) * 4] : receiver
// -----------------------------------
__ IncrementCounter(COUNTERS->string_ctor_calls(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->string_ctor_calls(), 1);
if (FLAG_debug_code) {
__ LoadGlobalFunction(Context::STRING_FUNCTION_INDEX, ecx);
@ -1312,7 +1314,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
edx, // Scratch 2.
false, // Input is known to be smi?
&not_cached);
__ IncrementCounter(COUNTERS->string_ctor_cached_number(), 1);
__ IncrementCounter(counters->string_ctor_cached_number(), 1);
__ bind(&argument_is_string);
// ----------- S t a t e -------------
// -- ebx : argument converted to string
@ -1364,12 +1366,12 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
Condition is_string = masm->IsObjectStringType(eax, ebx, ecx);
__ j(NegateCondition(is_string), &convert_argument);
__ mov(ebx, eax);
__ IncrementCounter(COUNTERS->string_ctor_string_value(), 1);
__ IncrementCounter(counters->string_ctor_string_value(), 1);
__ jmp(&argument_is_string);
// Invoke the conversion builtin and put the result into ebx.
__ bind(&convert_argument);
__ IncrementCounter(COUNTERS->string_ctor_conversions(), 1);
__ IncrementCounter(counters->string_ctor_conversions(), 1);
__ EnterInternalFrame();
__ push(edi); // Preserve the function.
__ push(eax);
@ -1391,7 +1393,7 @@ void Builtins::Generate_StringConstructCode(MacroAssembler* masm) {
// At this point the argument is already a string. Call runtime to
// create a string wrapper.
__ bind(&gc_required);
__ IncrementCounter(COUNTERS->string_ctor_gc_required(), 1);
__ IncrementCounter(counters->string_ctor_gc_required(), 1);
__ EnterInternalFrame();
__ push(ebx);
__ CallRuntime(Runtime::kNewStringWrapper, 1);
@ -1442,7 +1444,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// -----------------------------------
Label invoke, dont_adapt_arguments;
__ IncrementCounter(COUNTERS->arguments_adaptors(), 1);
__ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1);
Label enough, too_few;
__ cmp(eax, Operand(ebx));
@ -1490,7 +1492,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
Label fill;
__ bind(&fill);
__ inc(ecx);
__ push(Immediate(FACTORY->undefined_value()));
__ push(Immediate(masm->isolate()->factory()->undefined_value()));
__ cmp(ecx, Operand(ebx));
__ j(less, &fill);

View File

@ -364,7 +364,8 @@ void GenericBinaryOpStub::GenerateCall(
// Update flags to indicate that arguments are in registers.
SetArgsInRegisters();
__ IncrementCounter(COUNTERS->generic_binary_stub_calls_regs(), 1);
__ IncrementCounter(
masm->isolate()->counters()->generic_binary_stub_calls_regs(), 1);
}
// Call the stub.
@ -400,7 +401,8 @@ void GenericBinaryOpStub::GenerateCall(
// Update flags to indicate that arguments are in registers.
SetArgsInRegisters();
__ IncrementCounter(COUNTERS->generic_binary_stub_calls_regs(), 1);
__ IncrementCounter(
masm->isolate()->counters()->generic_binary_stub_calls_regs(), 1);
}
// Call the stub.
@ -435,7 +437,8 @@ void GenericBinaryOpStub::GenerateCall(
}
// Update flags to indicate that arguments are in registers.
SetArgsInRegisters();
__ IncrementCounter(COUNTERS->generic_binary_stub_calls_regs(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->generic_binary_stub_calls_regs(), 1);
}
// Call the stub.
@ -878,7 +881,8 @@ void GenericBinaryOpStub::GenerateSmiCode(MacroAssembler* masm, Label* slow) {
void GenericBinaryOpStub::Generate(MacroAssembler* masm) {
Label call_runtime;
__ IncrementCounter(COUNTERS->generic_binary_stub_calls(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->generic_binary_stub_calls(), 1);
if (runtime_operands_type_ == BinaryOpIC::UNINIT_OR_SMI) {
Label slow;
@ -2200,7 +2204,8 @@ void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) {
Label call_runtime;
__ IncrementCounter(COUNTERS->generic_binary_stub_calls(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->generic_binary_stub_calls(), 1);
switch (op_) {
case Token::ADD:
@ -3906,7 +3911,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
// edx: code
// edi: encoding of subject string (1 if ascii 0 if two_byte);
// All checks done. Now push arguments for native regexp code.
__ IncrementCounter(COUNTERS->regexp_entry_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->regexp_entry_native(), 1);
// Isolates: note we add an additional parameter here (isolate pointer).
static const int kRegExpExecuteArguments = 8;
@ -4251,7 +4257,8 @@ void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm,
index,
times_twice_pointer_size,
FixedArray::kHeaderSize + kPointerSize));
__ IncrementCounter(COUNTERS->number_to_string_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->number_to_string_native(), 1);
}
@ -5534,7 +5541,8 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ test(ecx, Operand(ecx));
__ j(not_zero, &second_not_zero_length);
// Second string is empty, result is first string which is already in eax.
__ IncrementCounter(COUNTERS->string_add_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
__ bind(&second_not_zero_length);
__ mov(ebx, FieldOperand(eax, String::kLengthOffset));
@ -5543,7 +5551,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ j(not_zero, &both_not_zero_length);
// First string is empty, result is second string which is in edx.
__ mov(eax, edx);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
// Both strings are non-empty.
@ -5577,7 +5585,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
StringHelper::GenerateTwoCharacterSymbolTableProbe(
masm, ebx, ecx, eax, edx, edi,
&make_two_character_string_no_reload, &make_two_character_string);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
// Allocate a two character string.
@ -5589,7 +5597,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ movzx_b(ebx, FieldOperand(eax, SeqAsciiString::kHeaderSize));
__ movzx_b(ecx, FieldOperand(edx, SeqAsciiString::kHeaderSize));
__ bind(&make_two_character_string_no_reload);
__ IncrementCounter(COUNTERS->string_add_make_two_char(), 1);
__ IncrementCounter(counters->string_add_make_two_char(), 1);
__ AllocateAsciiString(eax, // Result.
2, // Length.
edi, // Scratch 1.
@ -5600,7 +5608,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ or_(ebx, Operand(ecx));
// Set the characters in the new string.
__ mov_w(FieldOperand(eax, SeqAsciiString::kHeaderSize), ebx);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
__ bind(&longer_than_two);
@ -5631,7 +5639,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ mov(FieldOperand(ecx, ConsString::kFirstOffset), eax);
__ mov(FieldOperand(ecx, ConsString::kSecondOffset), edx);
__ mov(eax, ecx);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
__ bind(&non_ascii);
// At least one of the strings is two-byte. Check whether it happens
@ -5708,7 +5716,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
// edx: first char of second argument
// edi: length of second argument
StringHelper::GenerateCopyCharacters(masm, ecx, edx, edi, ebx, true);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
// Handle creating a flat two byte result.
@ -5749,7 +5757,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
// edx: first char of second argument
// edi: length of second argument
StringHelper::GenerateCopyCharacters(masm, ecx, edx, edi, ebx, false);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
// Just jump to runtime to add the two strings.
@ -6174,7 +6182,8 @@ void SubStringStub::Generate(MacroAssembler* masm) {
// esi: character of sub string start
StringHelper::GenerateCopyCharactersREP(masm, edi, esi, ecx, ebx, true);
__ mov(esi, edx); // Restore esi.
__ IncrementCounter(COUNTERS->sub_string_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->sub_string_native(), 1);
__ ret(3 * kPointerSize);
__ bind(&non_ascii_flat);
@ -6215,7 +6224,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
__ mov(esi, edx); // Restore esi.
__ bind(&return_eax);
__ IncrementCounter(COUNTERS->sub_string_native(), 1);
__ IncrementCounter(counters->sub_string_native(), 1);
__ ret(3 * kPointerSize);
// Just jump to runtime to create the sub string.
@ -6234,7 +6243,8 @@ void StringCompareStub::GenerateCompareFlatAsciiStrings(MacroAssembler* masm,
Label result_greater;
Label compare_lengths;
__ IncrementCounter(COUNTERS->string_compare_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->string_compare_native(), 1);
// Find minimum length.
NearLabel left_shorter;
@ -6325,7 +6335,7 @@ void StringCompareStub::Generate(MacroAssembler* masm) {
STATIC_ASSERT(EQUAL == 0);
STATIC_ASSERT(kSmiTag == 0);
__ Set(eax, Immediate(Smi::FromInt(EQUAL)));
__ IncrementCounter(COUNTERS->string_compare_native(), 1);
__ IncrementCounter(masm->isolate()->counters()->string_compare_native(), 1);
__ ret(2 * kPointerSize);
__ bind(&not_same);

View File

@ -5696,7 +5696,8 @@ void CodeGenerator::VisitArrayLiteral(ArrayLiteral* node) {
FastCloneShallowArrayStub stub(
FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length);
clone = frame_->CallStub(&stub, 3);
__ IncrementCounter(COUNTERS->cow_arrays_created_stub(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->cow_arrays_created_stub(), 1);
} else if (node->depth() > 1) {
clone = frame_->CallRuntime(Runtime::kCreateArrayLiteral, 3);
} else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
@ -9409,15 +9410,16 @@ void DeferredReferenceGetNamedValue::Generate() {
int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site());
// Here we use masm_-> instead of the __ macro because this is the
// instruction that gets patched and coverage code gets in the way.
Counters* counters = masm()->isolate()->counters();
if (is_contextual_) {
masm_->mov(is_dont_delete_ ? edx : ecx, -delta_to_patch_site);
__ IncrementCounter(COUNTERS->named_load_global_inline_miss(), 1);
__ IncrementCounter(counters->named_load_global_inline_miss(), 1);
if (is_dont_delete_) {
__ IncrementCounter(COUNTERS->dont_delete_hint_miss(), 1);
__ IncrementCounter(counters->dont_delete_hint_miss(), 1);
}
} else {
masm_->test(eax, Immediate(-delta_to_patch_site));
__ IncrementCounter(COUNTERS->named_load_inline_miss(), 1);
__ IncrementCounter(counters->named_load_inline_miss(), 1);
}
if (!dst_.is(eax)) __ mov(dst_, eax);
@ -9483,7 +9485,8 @@ void DeferredReferenceGetKeyedValue::Generate() {
// Here we use masm_-> instead of the __ macro because this is the
// instruction that gets patched and coverage code gets in the way.
masm_->test(eax, Immediate(-delta_to_patch_site));
__ IncrementCounter(COUNTERS->keyed_load_inline_miss(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_inline_miss(), 1);
if (!dst_.is(eax)) __ mov(dst_, eax);
}
@ -9519,7 +9522,8 @@ class DeferredReferenceSetKeyedValue: public DeferredCode {
void DeferredReferenceSetKeyedValue::Generate() {
__ IncrementCounter(COUNTERS->keyed_store_inline_miss(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_store_inline_miss(), 1);
// Move value_ to eax, key_ to ecx, and receiver_ to edx.
Register old_value = value_;
@ -9596,9 +9600,13 @@ Result CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
int original_height = frame()->height();
#endif
Isolate* isolate = masm()->isolate();
Factory* factory = isolate->factory();
Counters* counters = isolate->counters();
bool contextual_load_in_builtin =
is_contextual &&
(masm()->isolate()->bootstrapper()->IsActive() ||
(isolate->bootstrapper()->IsActive() ||
(!info_->closure().is_null() && info_->closure()->IsBuiltin()));
Result result;
@ -9644,7 +9652,7 @@ Result CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
// use the double underscore macro that may insert instructions).
// Initially use an invalid map to force a failure.
masm()->cmp(FieldOperand(receiver.reg(), HeapObject::kMapOffset),
Immediate(FACTORY->null_value()));
Immediate(factory->null_value()));
// This branch is always a forwards branch so it's always a fixed size
// which allows the assert below to succeed and patching to work.
deferred->Branch(not_equal);
@ -9656,15 +9664,15 @@ Result CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
if (is_contextual) {
// Load the (initialy invalid) cell and get its value.
masm()->mov(result.reg(), FACTORY->null_value());
masm()->mov(result.reg(), factory->null_value());
if (FLAG_debug_code) {
__ cmp(FieldOperand(result.reg(), HeapObject::kMapOffset),
FACTORY->global_property_cell_map());
factory->global_property_cell_map());
__ Assert(equal, "Uninitialized inlined contextual load");
}
__ mov(result.reg(),
FieldOperand(result.reg(), JSGlobalPropertyCell::kValueOffset));
__ cmp(result.reg(), FACTORY->the_hole_value());
__ cmp(result.reg(), factory->the_hole_value());
deferred->Branch(equal);
bool is_dont_delete = false;
if (!info_->closure().is_null()) {
@ -9684,15 +9692,15 @@ Result CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
}
deferred->set_is_dont_delete(is_dont_delete);
if (!is_dont_delete) {
__ cmp(result.reg(), FACTORY->the_hole_value());
__ cmp(result.reg(), factory->the_hole_value());
deferred->Branch(equal);
} else if (FLAG_debug_code) {
__ cmp(result.reg(), FACTORY->the_hole_value());
__ cmp(result.reg(), factory->the_hole_value());
__ Check(not_equal, "DontDelete cells can't contain the hole");
}
__ IncrementCounter(COUNTERS->named_load_global_inline(), 1);
__ IncrementCounter(counters->named_load_global_inline(), 1);
if (is_dont_delete) {
__ IncrementCounter(COUNTERS->dont_delete_hint_hit(), 1);
__ IncrementCounter(counters->dont_delete_hint_hit(), 1);
}
} else {
// The initial (invalid) offset has to be large enough to force a 32-bit
@ -9700,7 +9708,7 @@ Result CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
// kMaxInt (minus kHeapObjectTag).
int offset = kMaxInt;
masm()->mov(result.reg(), FieldOperand(receiver.reg(), offset));
__ IncrementCounter(COUNTERS->named_load_inline(), 1);
__ IncrementCounter(counters->named_load_inline(), 1);
}
deferred->BindExit();
@ -9888,7 +9896,7 @@ Result CodeGenerator::EmitKeyedLoad() {
result = elements;
__ cmp(Operand(result.reg()), Immediate(FACTORY->the_hole_value()));
deferred->Branch(equal);
__ IncrementCounter(COUNTERS->keyed_load_inline(), 1);
__ IncrementCounter(masm_->isolate()->counters()->keyed_load_inline(), 1);
deferred->BindExit();
} else {
@ -9993,7 +10001,7 @@ Result CodeGenerator::EmitKeyedStore(StaticType* key_type) {
// Store the value.
__ mov(FixedArrayElementOperand(tmp.reg(), key.reg()), result.reg());
__ IncrementCounter(COUNTERS->keyed_store_inline(), 1);
__ IncrementCounter(masm_->isolate()->counters()->keyed_store_inline(), 1);
deferred->BindExit();
} else {
@ -10224,7 +10232,7 @@ MemCopyFunction CreateMemCopyFunction() {
__ test(Operand(src), Immediate(0x0F));
__ j(not_zero, &unaligned_source);
{
__ IncrementCounter(COUNTERS->memcopy_aligned(), 1);
__ IncrementCounter(masm.isolate()->counters()->memcopy_aligned(), 1);
// Copy loop for aligned source and destination.
__ mov(edx, count);
Register loop_count = ecx;
@ -10272,7 +10280,7 @@ MemCopyFunction CreateMemCopyFunction() {
// Copy loop for unaligned source and aligned destination.
// If source is not aligned, we can't read it as efficiently.
__ bind(&unaligned_source);
__ IncrementCounter(COUNTERS->memcopy_unaligned(), 1);
__ IncrementCounter(masm.isolate()->counters()->memcopy_unaligned(), 1);
__ mov(edx, ecx);
Register loop_count = ecx;
Register count = edx;
@ -10316,7 +10324,7 @@ MemCopyFunction CreateMemCopyFunction() {
}
} else {
__ IncrementCounter(COUNTERS->memcopy_noxmm(), 1);
__ IncrementCounter(masm.isolate()->counters()->memcopy_noxmm(), 1);
// SSE2 not supported. Unlikely to happen in practice.
__ push(edi);
__ push(esi);

View File

@ -4227,18 +4227,19 @@ void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
void FullCodeGenerator::EmitCallIC(Handle<Code> ic, JumpPatchSite* patch_site) {
Counters* counters = masm()->isolate()->counters();
switch (ic->kind()) {
case Code::LOAD_IC:
__ IncrementCounter(COUNTERS->named_load_full(), 1);
__ IncrementCounter(counters->named_load_full(), 1);
break;
case Code::KEYED_LOAD_IC:
__ IncrementCounter(COUNTERS->keyed_load_full(), 1);
__ IncrementCounter(counters->keyed_load_full(), 1);
break;
case Code::STORE_IC:
__ IncrementCounter(COUNTERS->named_store_full(), 1);
__ IncrementCounter(counters->named_store_full(), 1);
break;
case Code::KEYED_STORE_IC:
__ IncrementCounter(COUNTERS->keyed_store_full(), 1);
__ IncrementCounter(counters->keyed_store_full(), 1);
default:
break;
}

View File

@ -555,7 +555,9 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
eax,
NULL,
&slow);
__ IncrementCounter(COUNTERS->keyed_load_generic_smi(), 1);
Isolate* isolate = masm->isolate();
Counters* counters = isolate->counters();
__ IncrementCounter(counters->keyed_load_generic_smi(), 1);
__ ret(0);
__ bind(&check_number_dictionary);
@ -568,7 +570,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// ebx: untagged index
// eax: key
// ecx: elements
__ CheckMap(ecx, FACTORY->hash_table_map(), &slow, true);
__ CheckMap(ecx, isolate->factory()->hash_table_map(), &slow, true);
Label slow_pop_receiver;
// Push receiver on the stack to free up a register for the dictionary
// probing.
@ -593,7 +595,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// Slow case: jump to runtime.
// edx: receiver
// eax: key
__ IncrementCounter(COUNTERS->keyed_load_generic_slow(), 1);
__ IncrementCounter(counters->keyed_load_generic_slow(), 1);
GenerateRuntimeGetProperty(masm);
__ bind(&check_string);
@ -606,7 +608,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// cache. Otherwise probe the dictionary.
__ mov(ebx, FieldOperand(edx, JSObject::kPropertiesOffset));
__ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
Immediate(FACTORY->hash_table_map()));
Immediate(isolate->factory()->hash_table_map()));
__ j(equal, &probe_dictionary);
// Load the map of the receiver, compute the keyed lookup cache hash
@ -648,7 +650,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
__ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset));
__ add(ecx, Operand(edi));
__ mov(eax, FieldOperand(edx, ecx, times_pointer_size, 0));
__ IncrementCounter(COUNTERS->keyed_load_generic_lookup_cache(), 1);
__ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
__ ret(0);
// Load property array property.
@ -656,7 +658,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
__ mov(eax, FieldOperand(edx, JSObject::kPropertiesOffset));
__ mov(eax, FieldOperand(eax, edi, times_pointer_size,
FixedArray::kHeaderSize));
__ IncrementCounter(COUNTERS->keyed_load_generic_lookup_cache(), 1);
__ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
__ ret(0);
// Do a quick inline probe of the receiver's dictionary, if it
@ -668,7 +670,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
GenerateGlobalInstanceTypeCheck(masm, ecx, &slow);
GenerateDictionaryLoad(masm, &slow, ebx, eax, ecx, edi, eax);
__ IncrementCounter(COUNTERS->keyed_load_generic_symbol(), 1);
__ IncrementCounter(counters->keyed_load_generic_symbol(), 1);
__ ret(0);
__ bind(&index_string);
@ -967,10 +969,11 @@ static void GenerateCallMiss(MacroAssembler* masm,
// -- esp[(argc + 1) * 4] : receiver
// -----------------------------------
Counters* counters = masm->isolate()->counters();
if (id == IC::kCallIC_Miss) {
__ IncrementCounter(COUNTERS->call_miss(), 1);
__ IncrementCounter(counters->call_miss(), 1);
} else {
__ IncrementCounter(COUNTERS->keyed_call_miss(), 1);
__ IncrementCounter(counters->keyed_call_miss(), 1);
}
// Get the receiver of the function from the stack; 1 ~ return address.
@ -1092,7 +1095,9 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
GenerateFastArrayLoad(
masm, edx, ecx, eax, edi, &check_number_dictionary, &slow_load);
__ IncrementCounter(COUNTERS->keyed_call_generic_smi_fast(), 1);
Isolate* isolate = masm->isolate();
Counters* counters = isolate->counters();
__ IncrementCounter(counters->keyed_call_generic_smi_fast(), 1);
__ bind(&do_call);
// receiver in edx is not used after this point.
@ -1104,14 +1109,14 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
// eax: elements
// ecx: smi key
// Check whether the elements is a number dictionary.
__ CheckMap(eax, FACTORY->hash_table_map(), &slow_load, true);
__ CheckMap(eax, isolate->factory()->hash_table_map(), &slow_load, true);
__ mov(ebx, ecx);
__ SmiUntag(ebx);
// ebx: untagged index
// Receiver in edx will be clobbered, need to reload it on miss.
GenerateNumberDictionaryLoad(
masm, &slow_reload_receiver, eax, ecx, ebx, edx, edi, edi);
__ IncrementCounter(COUNTERS->keyed_call_generic_smi_dict(), 1);
__ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1);
__ jmp(&do_call);
__ bind(&slow_reload_receiver);
@ -1120,7 +1125,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ bind(&slow_load);
// This branch is taken when calling KeyedCallIC_Miss is neither required
// nor beneficial.
__ IncrementCounter(COUNTERS->keyed_call_generic_slow_load(), 1);
__ IncrementCounter(counters->keyed_call_generic_slow_load(), 1);
__ EnterInternalFrame();
__ push(ecx); // save the key
__ push(edx); // pass the receiver
@ -1142,14 +1147,17 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
masm, edx, eax, Map::kHasNamedInterceptor, &lookup_monomorphic_cache);
__ mov(ebx, FieldOperand(edx, JSObject::kPropertiesOffset));
__ CheckMap(ebx, FACTORY->hash_table_map(), &lookup_monomorphic_cache, true);
__ CheckMap(ebx,
isolate->factory()->hash_table_map(),
&lookup_monomorphic_cache,
true);
GenerateDictionaryLoad(masm, &slow_load, ebx, ecx, eax, edi, edi);
__ IncrementCounter(COUNTERS->keyed_call_generic_lookup_dict(), 1);
__ IncrementCounter(counters->keyed_call_generic_lookup_dict(), 1);
__ jmp(&do_call);
__ bind(&lookup_monomorphic_cache);
__ IncrementCounter(COUNTERS->keyed_call_generic_lookup_cache(), 1);
__ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1);
GenerateMonomorphicCacheProbe(masm, argc, Code::KEYED_CALL_IC);
// Fall through on miss.
@ -1160,7 +1168,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
// - the value loaded is not a function,
// - there is hope that the runtime will create a monomorphic call stub
// that will get fetched next time.
__ IncrementCounter(COUNTERS->keyed_call_generic_slow(), 1);
__ IncrementCounter(counters->keyed_call_generic_slow(), 1);
GenerateMiss(masm, argc);
__ bind(&index_string);
@ -1251,7 +1259,7 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(COUNTERS->load_miss(), 1);
__ IncrementCounter(masm->isolate()->counters()->load_miss(), 1);
__ pop(ebx);
__ push(eax); // receiver
@ -1438,7 +1446,7 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
// -- esp[0] : return address
// -----------------------------------
__ IncrementCounter(COUNTERS->keyed_load_miss(), 1);
__ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1);
__ pop(ebx);
__ push(edx); // receiver
@ -1589,14 +1597,15 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
__ push(edx);
GenerateDictionaryStore(masm, &restore_miss, ebx, ecx, eax, edx, edi);
__ Drop(1);
__ IncrementCounter(COUNTERS->store_normal_hit(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->store_normal_hit(), 1);
__ ret(0);
__ bind(&restore_miss);
__ pop(edx);
__ bind(&miss);
__ IncrementCounter(COUNTERS->store_normal_miss(), 1);
__ IncrementCounter(counters->store_normal_miss(), 1);
GenerateMiss(masm);
}

View File

@ -114,8 +114,9 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
Register r0,
Register r1) {
ASSERT(name->IsSymbol());
__ IncrementCounter(COUNTERS->negative_lookups(), 1);
__ IncrementCounter(COUNTERS->negative_lookups_miss(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->negative_lookups(), 1);
__ IncrementCounter(counters->negative_lookups_miss(), 1);
Label done;
__ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset));
@ -198,7 +199,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
}
__ bind(&done);
__ DecrementCounter(COUNTERS->negative_lookups_miss(), 1);
__ DecrementCounter(counters->negative_lookups_miss(), 1);
}
@ -614,10 +615,11 @@ class CallInterceptorCompiler BASE_EMBEDDED {
(depth2 != kInvalidProtoDepth);
}
__ IncrementCounter(COUNTERS->call_const_interceptor(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->call_const_interceptor(), 1);
if (can_do_fast_api_call) {
__ IncrementCounter(COUNTERS->call_const_interceptor_fast_api(), 1);
__ IncrementCounter(counters->call_const_interceptor_fast_api(), 1);
ReserveSpaceForFastApiCall(masm, scratch1);
}
@ -2155,8 +2157,9 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
__ test(edx, Immediate(kSmiTagMask));
__ j(zero, &miss_before_stack_reserved, not_taken);
__ IncrementCounter(COUNTERS->call_const(), 1);
__ IncrementCounter(COUNTERS->call_const_fast_api(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->call_const(), 1);
__ IncrementCounter(counters->call_const_fast_api(), 1);
// Allocate space for v8::Arguments implicit values. Must be initialized
// before calling any runtime function.
@ -2230,7 +2233,7 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
SharedFunctionInfo* function_info = function->shared();
switch (check) {
case RECEIVER_MAP_CHECK:
__ IncrementCounter(COUNTERS->call_const(), 1);
__ IncrementCounter(masm()->isolate()->counters()->call_const(), 1);
// Check that the maps haven't changed.
CheckPrototypes(JSObject::cast(object), edx, holder,
@ -2430,7 +2433,8 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
// Jump to the cached code (tail call).
__ IncrementCounter(COUNTERS->call_global_inline(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->call_global_inline(), 1);
ASSERT(function->is_compiled());
ParameterCount expected(function->shared()->formal_parameter_count());
if (V8::UseCrankshaft()) {
@ -2447,7 +2451,7 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
// Handle call cache miss.
__ bind(&miss);
__ IncrementCounter(COUNTERS->call_global_inline_miss(), 1);
__ IncrementCounter(counters->call_global_inline_miss(), 1);
MaybeObject* maybe_result = GenerateMissBranch();
if (maybe_result->IsFailure()) return maybe_result;
@ -2626,12 +2630,13 @@ MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
__ mov(cell_operand, eax);
// Return the value (register eax).
__ IncrementCounter(COUNTERS->named_store_global_inline(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->named_store_global_inline(), 1);
__ ret(0);
// Handle store cache miss.
__ bind(&miss);
__ IncrementCounter(COUNTERS->named_store_global_inline_miss(), 1);
__ IncrementCounter(counters->named_store_global_inline_miss(), 1);
Handle<Code> ic(Isolate::Current()->builtins()->builtin(
Builtins::StoreIC_Miss));
__ jmp(ic, RelocInfo::CODE_TARGET);
@ -2653,7 +2658,8 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_store_field(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_store_field(), 1);
// Check that the name has not changed.
__ cmp(Operand(ecx), Immediate(Handle<String>(name)));
@ -2669,7 +2675,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
// Handle store cache miss.
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_store_field(), 1);
__ DecrementCounter(counters->keyed_store_field(), 1);
Handle<Code> ic(Isolate::Current()->builtins()->builtin(
Builtins::KeyedStoreIC_Miss));
__ jmp(ic, RelocInfo::CODE_TARGET);
@ -2925,12 +2931,13 @@ MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
__ Check(not_equal, "DontDelete cells can't contain the hole");
}
__ IncrementCounter(COUNTERS->named_load_global_stub(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->named_load_global_stub(), 1);
__ mov(eax, ebx);
__ ret(0);
__ bind(&miss);
__ IncrementCounter(COUNTERS->named_load_global_stub_miss(), 1);
__ IncrementCounter(counters->named_load_global_stub_miss(), 1);
GenerateLoadMiss(masm(), Code::LOAD_IC);
// Return the generated code.
@ -2949,7 +2956,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_field(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_field(), 1);
// Check that the name has not changed.
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
@ -2958,7 +2966,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
GenerateLoadField(receiver, holder, edx, ebx, ecx, edi, index, name, &miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_field(), 1);
__ DecrementCounter(counters->keyed_load_field(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -2978,7 +2986,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback(
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_callback(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_callback(), 1);
// Check that the name has not changed.
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
@ -2993,7 +3002,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback(
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_callback(), 1);
__ DecrementCounter(counters->keyed_load_callback(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -3012,7 +3021,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_constant_function(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_constant_function(), 1);
// Check that the name has not changed.
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
@ -3021,7 +3031,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
GenerateLoadConstant(receiver, holder, edx, ebx, ecx, edi,
value, name, &miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_constant_function(), 1);
__ DecrementCounter(counters->keyed_load_constant_function(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -3039,7 +3049,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_interceptor(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_interceptor(), 1);
// Check that the name has not changed.
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
@ -3058,7 +3069,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
name,
&miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_interceptor(), 1);
__ DecrementCounter(counters->keyed_load_interceptor(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -3074,7 +3085,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_array_length(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_array_length(), 1);
// Check that the name has not changed.
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
@ -3082,7 +3094,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
GenerateLoadArrayLength(masm(), edx, ecx, &miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_array_length(), 1);
__ DecrementCounter(counters->keyed_load_array_length(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -3098,7 +3110,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_string_length(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_string_length(), 1);
// Check that the name has not changed.
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
@ -3106,7 +3119,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss, true);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_string_length(), 1);
__ DecrementCounter(counters->keyed_load_string_length(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -3122,7 +3135,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_function_prototype(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_function_prototype(), 1);
// Check that the name has not changed.
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
@ -3130,7 +3144,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
GenerateLoadFunctionPrototype(masm(), edx, ecx, ebx, &miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_function_prototype(), 1);
__ DecrementCounter(counters->keyed_load_function_prototype(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -3305,8 +3319,9 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
__ pop(ecx);
__ lea(esp, Operand(esp, ebx, times_pointer_size, 1 * kPointerSize));
__ push(ecx);
__ IncrementCounter(COUNTERS->constructed_objects(), 1);
__ IncrementCounter(COUNTERS->constructed_objects_stub(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->constructed_objects(), 1);
__ IncrementCounter(counters->constructed_objects_stub(), 1);
__ ret(0);
// Jump to the generic stub in case the specialized code cannot handle the
@ -3454,7 +3469,8 @@ MaybeObject* ExternalArrayStubCompiler::CompileKeyedLoadStub(
// Slow case: Jump to runtime.
__ bind(&slow);
__ IncrementCounter(COUNTERS->keyed_load_external_array_slow(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_external_array_slow(), 1);
// ----------- S t a t e -------------
// -- eax : key
// -- edx : receiver

View File

@ -140,7 +140,7 @@ void JumpTarget::ComputeEntryFrame() {
// the directionality of the block. Compute: an entry frame for the
// block.
COUNTERS->compute_entry_frame()->Increment();
Isolate::Current()->counters()->compute_entry_frame()->Increment();
#ifdef DEBUG
if (Isolate::Current()->jump_target_compiling_deferred_code()) {
ASSERT(reaching_frames_.length() > 1);

View File

@ -52,24 +52,25 @@ namespace internal {
//
class SlidingStateWindow {
public:
SlidingStateWindow();
explicit SlidingStateWindow(Isolate* isolate);
~SlidingStateWindow();
void AddState(StateTag state);
private:
static const int kBufferSize = 256;
Counters* counters_;
int current_index_;
bool is_full_;
byte buffer_[kBufferSize];
void IncrementStateCounter(StateTag state) {
COUNTERS->state_counters(state)->Increment();
counters_->state_counters(state)->Increment();
}
void DecrementStateCounter(StateTag state) {
COUNTERS->state_counters(state)->Decrement();
counters_->state_counters(state)->Decrement();
}
};
@ -238,11 +239,12 @@ class Ticker: public Sampler {
//
// SlidingStateWindow implementation.
//
SlidingStateWindow::SlidingStateWindow(): current_index_(0), is_full_(false) {
SlidingStateWindow::SlidingStateWindow(Isolate* isolate)
: counters_(isolate->counters()), current_index_(0), is_full_(false) {
for (int i = 0; i < kBufferSize; i++) {
buffer_[i] = static_cast<byte>(OTHER);
}
LOGGER->ticker_->SetWindow(this);
isolate->logger()->ticker_->SetWindow(this);
}
@ -1515,8 +1517,9 @@ bool Logger::Setup() {
ticker_ = new Ticker(Isolate::Current(), kSamplingIntervalMs);
Isolate* isolate = Isolate::Current();
if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
sliding_state_window_ = new SlidingStateWindow();
sliding_state_window_ = new SlidingStateWindow(isolate);
}
bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api
@ -1528,7 +1531,7 @@ bool Logger::Setup() {
}
if (FLAG_prof) {
profiler_ = new Profiler(Isolate::Current());
profiler_ = new Profiler(isolate);
if (!FLAG_prof_auto) {
profiler_->pause();
} else {
@ -1603,7 +1606,7 @@ void Logger::EnableSlidingStateWindow() {
// Otherwise, if the sliding state window computation has not been
// started we do it now.
if (sliding_state_window_ == NULL) {
sliding_state_window_ = new SlidingStateWindow();
sliding_state_window_ = new SlidingStateWindow(Isolate::Current());
}
#endif
}

View File

@ -2355,6 +2355,7 @@ PropertyAttributes JSObject::GetLocalPropertyAttribute(String* name) {
MaybeObject* NormalizedMapCache::Get(JSObject* obj,
PropertyNormalizationMode mode) {
Isolate* isolate = obj->GetIsolate();
Map* fast = obj->map();
int index = Hash(fast) % kEntries;
Object* result = get(index);
@ -2381,7 +2382,7 @@ MaybeObject* NormalizedMapCache::Get(JSObject* obj,
if (!maybe_result->ToObject(&result)) return maybe_result;
}
set(index, result);
COUNTERS->normalized_maps()->Increment();
isolate->counters()->normalized_maps()->Increment();
return result;
}
@ -2441,7 +2442,7 @@ MaybeObject* JSObject::UpdateMapCodeCache(String* name, Code* code) {
UNIQUE_NORMALIZED_MAP);
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
}
COUNTERS->normalized_maps()->Increment();
GetIsolate()->counters()->normalized_maps()->Increment();
set_map(Map::cast(obj));
}

View File

@ -284,7 +284,7 @@ Handle<String> Parser::LookupCachedSymbol(int symbol_id) {
symbol_cache_.at(symbol_id) = result;
return result;
}
COUNTERS->total_preparse_symbols_skipped()->Increment();
isolate()->counters()->total_preparse_symbols_skipped()->Increment();
return result;
}
@ -599,8 +599,8 @@ FunctionLiteral* Parser::ParseProgram(Handle<String> source,
StrictModeFlag strict_mode) {
CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
HistogramTimerScope timer(COUNTERS->parse());
COUNTERS->total_parse_size()->Increment(source->length());
HistogramTimerScope timer(isolate()->counters()->parse());
isolate()->counters()->total_parse_size()->Increment(source->length());
fni_ = new FuncNameInferrer();
// Initialize parser state.
@ -681,9 +681,9 @@ FunctionLiteral* Parser::DoParseProgram(Handle<String> source,
FunctionLiteral* Parser::ParseLazy(CompilationInfo* info) {
CompilationZoneScope zone_scope(DONT_DELETE_ON_EXIT);
HistogramTimerScope timer(COUNTERS->parse_lazy());
HistogramTimerScope timer(isolate()->counters()->parse_lazy());
Handle<String> source(String::cast(script_->source()));
COUNTERS->total_parse_size()->Increment(source->length());
isolate()->counters()->total_parse_size()->Increment(source->length());
Handle<SharedFunctionInfo> shared_info = info->shared_info();
// Initialize parser state.
@ -3608,7 +3608,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name,
// End position greater than end of stream is safe, and hard to check.
ReportInvalidPreparseData(name, CHECK_OK);
}
COUNTERS->total_preparse_skipped()->Increment(
isolate()->counters()->total_preparse_skipped()->Increment(
end_pos - function_block_pos);
// Seek to position just before terminal '}'.
scanner().SeekForward(end_pos - 1);

View File

@ -593,7 +593,7 @@ static MaybeObject* Runtime_CreateArrayLiteralShallow(
}
if (JSObject::cast(*boilerplate)->elements()->map() ==
isolate->heap()->fixed_cow_array_map()) {
COUNTERS->cow_arrays_created_runtime()->Increment();
isolate->counters()->cow_arrays_created_runtime()->Increment();
}
return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate));
}
@ -12218,16 +12218,17 @@ const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
void Runtime::PerformGC(Object* result) {
Isolate* isolate = Isolate::Current();
Failure* failure = Failure::cast(result);
if (failure->IsRetryAfterGC()) {
// Try to do a garbage collection; ignore it if it fails. The C
// entry stub will throw an out-of-memory exception in that case.
HEAP->CollectGarbage(failure->allocation_space());
isolate->heap()->CollectGarbage(failure->allocation_space());
} else {
// Handle last resort GC and make sure to allow future allocations
// to grow the heap without causing GCs (if possible).
COUNTERS->gc_last_resort_from_js()->Increment();
HEAP->CollectAllGarbage(false);
isolate->counters()->gc_last_resort_from_js()->Increment();
isolate->heap()->CollectAllGarbage(false);
}
}

View File

@ -393,7 +393,7 @@ void* MemoryAllocator::AllocateRawMemory(const size_t requested,
#ifdef DEBUG
ZapBlock(reinterpret_cast<Address>(mem), alloced);
#endif
COUNTERS->memory_allocated()->Increment(alloced);
isolate_->counters()->memory_allocated()->Increment(alloced);
return mem;
}
@ -409,7 +409,7 @@ void MemoryAllocator::FreeRawMemory(void* mem,
} else {
OS::Free(mem, length);
}
COUNTERS->memory_allocated()->Decrement(static_cast<int>(length));
isolate_->counters()->memory_allocated()->Decrement(static_cast<int>(length));
size_ -= static_cast<int>(length);
if (executable == EXECUTABLE) size_executable_ -= static_cast<int>(length);
@ -537,7 +537,7 @@ Page* MemoryAllocator::CommitPages(Address start, size_t size,
#ifdef DEBUG
ZapBlock(start, size);
#endif
COUNTERS->memory_allocated()->Increment(static_cast<int>(size));
isolate_->counters()->memory_allocated()->Increment(static_cast<int>(size));
// So long as we correctly overestimated the number of chunks we should not
// run out of chunk ids.
@ -561,7 +561,7 @@ bool MemoryAllocator::CommitBlock(Address start,
#ifdef DEBUG
ZapBlock(start, size);
#endif
COUNTERS->memory_allocated()->Increment(static_cast<int>(size));
isolate_->counters()->memory_allocated()->Increment(static_cast<int>(size));
return true;
}
@ -574,7 +574,7 @@ bool MemoryAllocator::UncommitBlock(Address start, size_t size) {
ASSERT(InInitialChunk(start + size - 1));
if (!initial_chunk_->Uncommit(start, size)) return false;
COUNTERS->memory_allocated()->Decrement(static_cast<int>(size));
isolate_->counters()->memory_allocated()->Decrement(static_cast<int>(size));
return true;
}
@ -675,7 +675,8 @@ void MemoryAllocator::DeleteChunk(int chunk_id) {
// TODO(1240712): VirtualMemory::Uncommit has a return value which
// is ignored here.
initial_chunk_->Uncommit(c.address(), c.size());
COUNTERS->memory_allocated()->Decrement(static_cast<int>(c.size()));
Counters* counters = isolate_->counters();
counters->memory_allocated()->Decrement(static_cast<int>(c.size()));
} else {
LOG(isolate_, DeleteEvent("PagedChunk", c.address()));
ObjectSpace space = static_cast<ObjectSpace>(1 << c.owner_identity());
@ -2753,7 +2754,7 @@ LargeObjectChunk* LargeObjectChunk::New(int size_in_bytes,
LargeObjectChunk* chunk = reinterpret_cast<LargeObjectChunk*>(mem);
chunk->size_ = size;
Page* page = Page::FromAddress(RoundUp(chunk->address(), Page::kPageSize));
page->heap_ = Isolate::Current()->heap();
page->heap_ = isolate->heap();
return chunk;
}

View File

@ -1500,7 +1500,7 @@ MaybeObject* StubCompiler::CompileCallInitialize(Code::Flags flags) {
GetCodeWithFlags(flags, "CompileCallInitialize");
if (!maybe_result->ToObject(&result)) return maybe_result;
}
COUNTERS->call_initialize_stubs()->Increment();
isolate()->counters()->call_initialize_stubs()->Increment();
Code* code = Code::cast(result);
USE(code);
PROFILE(isolate(),
@ -1527,7 +1527,7 @@ MaybeObject* StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) {
GetCodeWithFlags(flags, "CompileCallPreMonomorphic");
if (!maybe_result->ToObject(&result)) return maybe_result;
}
COUNTERS->call_premonomorphic_stubs()->Increment();
isolate()->counters()->call_premonomorphic_stubs()->Increment();
Code* code = Code::cast(result);
USE(code);
PROFILE(isolate(),
@ -1551,7 +1551,7 @@ MaybeObject* StubCompiler::CompileCallNormal(Code::Flags flags) {
{ MaybeObject* maybe_result = GetCodeWithFlags(flags, "CompileCallNormal");
if (!maybe_result->ToObject(&result)) return maybe_result;
}
COUNTERS->call_normal_stubs()->Increment();
isolate()->counters()->call_normal_stubs()->Increment();
Code* code = Code::cast(result);
USE(code);
PROFILE(isolate(),
@ -1576,7 +1576,7 @@ MaybeObject* StubCompiler::CompileCallMegamorphic(Code::Flags flags) {
GetCodeWithFlags(flags, "CompileCallMegamorphic");
if (!maybe_result->ToObject(&result)) return maybe_result;
}
COUNTERS->call_megamorphic_stubs()->Increment();
isolate()->counters()->call_megamorphic_stubs()->Increment();
Code* code = Code::cast(result);
USE(code);
PROFILE(isolate(),
@ -1600,7 +1600,7 @@ MaybeObject* StubCompiler::CompileCallMiss(Code::Flags flags) {
{ MaybeObject* maybe_result = GetCodeWithFlags(flags, "CompileCallMiss");
if (!maybe_result->ToObject(&result)) return maybe_result;
}
COUNTERS->call_megamorphic_stubs()->Increment();
isolate()->counters()->call_megamorphic_stubs()->Increment();
Code* code = Code::cast(result);
USE(code);
PROFILE(isolate(),

View File

@ -207,8 +207,6 @@ namespace internal {
SC(memcopy_noxmm, V8.MemCopyNoXMM) \
SC(enum_cache_hits, V8.EnumCacheHits) \
SC(enum_cache_misses, V8.EnumCacheMisses) \
SC(reloc_info_count, V8.RelocInfoCount) \
SC(reloc_info_size, V8.RelocInfoSize) \
SC(zone_segment_bytes, V8.ZoneSegmentBytes) \
SC(compute_entry_frame, V8.ComputeEntryFrame) \
SC(generic_binary_stub_calls, V8.GenericBinaryStubCalls) \
@ -311,8 +309,6 @@ class Counters {
DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
};
#define COUNTERS Isolate::Current()->counters()
} } // namespace v8::internal
#endif // V8_V8_COUNTERS_H_

View File

@ -415,8 +415,6 @@ void Assembler::GetCode(CodeDesc* desc) {
desc->reloc_size =
static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos());
desc->origin = this;
COUNTERS->reloc_info_size()->Increment(desc->reloc_size);
}

View File

@ -379,7 +379,8 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
SmiIndex index = masm->SmiToIndex(rbx, rbx, kPointerSizeLog2);
__ lea(rsp, Operand(rsp, index.reg, index.scale, 1 * kPointerSize));
__ push(rcx);
__ IncrementCounter(COUNTERS->constructed_objects(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->constructed_objects(), 1);
__ ret(0);
}
@ -1138,7 +1139,8 @@ static void ArrayNativeCode(MacroAssembler* masm,
r8,
kPreallocatedArrayElements,
call_generic_code);
__ IncrementCounter(COUNTERS->array_function_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->array_function_native(), 1);
__ movq(rax, rbx);
__ ret(kPointerSize);
@ -1169,7 +1171,7 @@ static void ArrayNativeCode(MacroAssembler* masm,
r9,
true,
call_generic_code);
__ IncrementCounter(COUNTERS->array_function_native(), 1);
__ IncrementCounter(counters->array_function_native(), 1);
__ movq(rax, rbx);
__ ret(2 * kPointerSize);
@ -1191,7 +1193,7 @@ static void ArrayNativeCode(MacroAssembler* masm,
r9,
false,
call_generic_code);
__ IncrementCounter(COUNTERS->array_function_native(), 1);
__ IncrementCounter(counters->array_function_native(), 1);
// rax: argc
// rbx: JSArray
@ -1356,7 +1358,8 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// -----------------------------------
Label invoke, dont_adapt_arguments;
__ IncrementCounter(COUNTERS->arguments_adaptors(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->arguments_adaptors(), 1);
Label enough, too_few;
__ cmpq(rax, rbx);

View File

@ -359,7 +359,8 @@ void GenericBinaryOpStub::GenerateCall(
// Update flags to indicate that arguments are in registers.
SetArgsInRegisters();
__ IncrementCounter(COUNTERS->generic_binary_stub_calls_regs(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->generic_binary_stub_calls_regs(), 1);
}
// Call the stub.
@ -395,7 +396,8 @@ void GenericBinaryOpStub::GenerateCall(
// Update flags to indicate that arguments are in registers.
SetArgsInRegisters();
__ IncrementCounter(COUNTERS->generic_binary_stub_calls_regs(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->generic_binary_stub_calls_regs(), 1);
}
// Call the stub.
@ -430,7 +432,8 @@ void GenericBinaryOpStub::GenerateCall(
}
// Update flags to indicate that arguments are in registers.
SetArgsInRegisters();
__ IncrementCounter(COUNTERS->generic_binary_stub_calls_regs(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->generic_binary_stub_calls_regs(), 1);
}
// Call the stub.
@ -2599,7 +2602,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
// rcx: encoding of subject string (1 if ascii 0 if two_byte);
// r11: code
// All checks done. Now push arguments for native regexp code.
__ IncrementCounter(COUNTERS->regexp_entry_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->regexp_entry_native(), 1);
// Isolates: note we add an additional parameter here (isolate pointer).
static const int kRegExpExecuteArguments = 8;
@ -2951,7 +2955,8 @@ void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm,
index,
times_1,
FixedArray::kHeaderSize + kPointerSize));
__ IncrementCounter(COUNTERS->number_to_string_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->number_to_string_native(), 1);
}
@ -4173,7 +4178,8 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ SmiTest(rcx);
__ j(not_zero, &second_not_zero_length);
// Second string is empty, result is first string which is already in rax.
__ IncrementCounter(COUNTERS->string_add_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
__ bind(&second_not_zero_length);
__ movq(rbx, FieldOperand(rax, String::kLengthOffset));
@ -4181,7 +4187,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ j(not_zero, &both_not_zero_length);
// First string is empty, result is second string which is in rdx.
__ movq(rax, rdx);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
// Both strings are non-empty.
@ -4225,7 +4231,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
Label make_two_character_string, make_flat_ascii_string;
StringHelper::GenerateTwoCharacterSymbolTableProbe(
masm, rbx, rcx, r14, r11, rdi, r15, &make_two_character_string);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
__ bind(&make_two_character_string);
@ -4265,7 +4271,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
__ movq(FieldOperand(rcx, ConsString::kFirstOffset), rax);
__ movq(FieldOperand(rcx, ConsString::kSecondOffset), rdx);
__ movq(rax, rcx);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
__ bind(&non_ascii);
// At least one of the strings is two-byte. Check whether it happens
@ -4339,7 +4345,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
// rdi: length of second argument
StringHelper::GenerateCopyCharacters(masm, rcx, rdx, rdi, true);
__ movq(rax, rbx);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
// Handle creating a flat two byte result.
@ -4376,7 +4382,7 @@ void StringAddStub::Generate(MacroAssembler* masm) {
// rdi: length of second argument
StringHelper::GenerateCopyCharacters(masm, rcx, rdx, rdi, false);
__ movq(rax, rbx);
__ IncrementCounter(COUNTERS->string_add_native(), 1);
__ IncrementCounter(counters->string_add_native(), 1);
__ ret(2 * kPointerSize);
// Just jump to runtime to add the two strings.
@ -4791,7 +4797,8 @@ void SubStringStub::Generate(MacroAssembler* masm) {
// rsi: character of sub string start
StringHelper::GenerateCopyCharactersREP(masm, rdi, rsi, rcx, true);
__ movq(rsi, rdx); // Restore rsi.
__ IncrementCounter(COUNTERS->sub_string_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->sub_string_native(), 1);
__ ret(kArgumentsSize);
__ bind(&non_ascii_flat);
@ -4828,7 +4835,7 @@ void SubStringStub::Generate(MacroAssembler* masm) {
__ movq(rsi, rdx); // Restore esi.
__ bind(&return_rax);
__ IncrementCounter(COUNTERS->sub_string_native(), 1);
__ IncrementCounter(counters->sub_string_native(), 1);
__ ret(kArgumentsSize);
// Just jump to runtime to create the sub string.
@ -4942,7 +4949,8 @@ void StringCompareStub::Generate(MacroAssembler* masm) {
__ cmpq(rdx, rax);
__ j(not_equal, &not_same);
__ Move(rax, Smi::FromInt(EQUAL));
__ IncrementCounter(COUNTERS->string_compare_native(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->string_compare_native(), 1);
__ ret(2 * kPointerSize);
__ bind(&not_same);
@ -4951,7 +4959,7 @@ void StringCompareStub::Generate(MacroAssembler* masm) {
__ JumpIfNotBothSequentialAsciiStrings(rdx, rax, rcx, rbx, &runtime);
// Inline comparison of ascii strings.
__ IncrementCounter(COUNTERS->string_compare_native(), 1);
__ IncrementCounter(counters->string_compare_native(), 1);
// Drop arguments from the stack
__ pop(rcx);
__ addq(rsp, Immediate(2 * kPointerSize));

View File

@ -4982,7 +4982,8 @@ void CodeGenerator::VisitArrayLiteral(ArrayLiteral* node) {
FastCloneShallowArrayStub stub(
FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length);
clone = frame_->CallStub(&stub, 3);
__ IncrementCounter(COUNTERS->cow_arrays_created_stub(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->cow_arrays_created_stub(), 1);
} else if (node->depth() > 1) {
clone = frame_->CallRuntime(Runtime::kCreateArrayLiteral, 3);
} else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
@ -8011,7 +8012,8 @@ void DeferredReferenceGetNamedValue::Generate() {
// Here we use masm_-> instead of the __ macro because this is the
// instruction that gets patched and coverage code gets in the way.
masm_->testl(rax, Immediate(-delta_to_patch_site));
__ IncrementCounter(COUNTERS->named_load_inline_miss(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->named_load_inline_miss(), 1);
if (!dst_.is(rax)) __ movq(dst_, rax);
}
@ -8079,7 +8081,8 @@ void DeferredReferenceGetKeyedValue::Generate() {
// 7-byte NOP with non-zero immediate (0f 1f 80 xxxxxxxx) which won't
// be generated normally.
masm_->testl(rax, Immediate(-delta_to_patch_site));
__ IncrementCounter(COUNTERS->keyed_load_inline_miss(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_inline_miss(), 1);
if (!dst_.is(rax)) __ movq(dst_, rax);
}
@ -8112,7 +8115,8 @@ class DeferredReferenceSetKeyedValue: public DeferredCode {
void DeferredReferenceSetKeyedValue::Generate() {
__ IncrementCounter(COUNTERS->keyed_store_inline_miss(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_store_inline_miss(), 1);
// Move value, receiver, and key to registers rax, rdx, and rcx, as
// the IC stub expects.
// Move value to rax, using xchg if the receiver or key is in rax.
@ -8247,7 +8251,8 @@ Result CodeGenerator::EmitNamedLoad(Handle<String> name, bool is_contextual) {
int offset = kMaxInt;
masm()->movq(result.reg(), FieldOperand(receiver.reg(), offset));
__ IncrementCounter(COUNTERS->named_load_inline(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->named_load_inline(), 1);
deferred->BindExit();
}
ASSERT(frame()->height() == original_height - 1);
@ -8454,7 +8459,8 @@ Result CodeGenerator::EmitKeyedLoad() {
result = elements;
__ CompareRoot(result.reg(), Heap::kTheHoleValueRootIndex);
deferred->Branch(equal);
__ IncrementCounter(COUNTERS->keyed_load_inline(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_inline(), 1);
deferred->BindExit();
} else {
@ -8565,7 +8571,8 @@ Result CodeGenerator::EmitKeyedStore(StaticType* key_type) {
index.scale,
FixedArray::kHeaderSize),
result.reg());
__ IncrementCounter(COUNTERS->keyed_store_inline(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_store_inline(), 1);
deferred->BindExit();
} else {

View File

@ -3884,18 +3884,19 @@ Register FullCodeGenerator::context_register() {
void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
ASSERT(mode == RelocInfo::CODE_TARGET ||
mode == RelocInfo::CODE_TARGET_CONTEXT);
Counters* counters = isolate()->counters();
switch (ic->kind()) {
case Code::LOAD_IC:
__ IncrementCounter(COUNTERS->named_load_full(), 1);
__ IncrementCounter(counters->named_load_full(), 1);
break;
case Code::KEYED_LOAD_IC:
__ IncrementCounter(COUNTERS->keyed_load_full(), 1);
__ IncrementCounter(counters->keyed_load_full(), 1);
break;
case Code::STORE_IC:
__ IncrementCounter(COUNTERS->named_store_full(), 1);
__ IncrementCounter(counters->named_store_full(), 1);
break;
case Code::KEYED_STORE_IC:
__ IncrementCounter(COUNTERS->keyed_store_full(), 1);
__ IncrementCounter(counters->keyed_store_full(), 1);
default:
break;
}
@ -3927,18 +3928,19 @@ void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
void FullCodeGenerator::EmitCallIC(Handle<Code> ic, JumpPatchSite* patch_site) {
Counters* counters = isolate()->counters();
switch (ic->kind()) {
case Code::LOAD_IC:
__ IncrementCounter(COUNTERS->named_load_full(), 1);
__ IncrementCounter(counters->named_load_full(), 1);
break;
case Code::KEYED_LOAD_IC:
__ IncrementCounter(COUNTERS->keyed_load_full(), 1);
__ IncrementCounter(counters->keyed_load_full(), 1);
break;
case Code::STORE_IC:
__ IncrementCounter(COUNTERS->named_store_full(), 1);
__ IncrementCounter(counters->named_store_full(), 1);
break;
case Code::KEYED_STORE_IC:
__ IncrementCounter(COUNTERS->keyed_store_full(), 1);
__ IncrementCounter(counters->keyed_store_full(), 1);
default:
break;
}

View File

@ -579,7 +579,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
rax,
NULL,
&slow);
__ IncrementCounter(COUNTERS->keyed_load_generic_smi(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->keyed_load_generic_smi(), 1);
__ ret(0);
__ bind(&check_number_dictionary);
@ -601,7 +602,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// Slow case: Jump to runtime.
// rdx: receiver
// rax: key
__ IncrementCounter(COUNTERS->keyed_load_generic_slow(), 1);
__ IncrementCounter(counters->keyed_load_generic_slow(), 1);
GenerateRuntimeGetProperty(masm);
__ bind(&check_string);
@ -652,7 +653,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
__ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset));
__ addq(rcx, rdi);
__ movq(rax, FieldOperand(rdx, rcx, times_pointer_size, 0));
__ IncrementCounter(COUNTERS->keyed_load_generic_lookup_cache(), 1);
__ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
__ ret(0);
// Load property array property.
@ -660,7 +661,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
__ movq(rax, FieldOperand(rdx, JSObject::kPropertiesOffset));
__ movq(rax, FieldOperand(rax, rdi, times_pointer_size,
FixedArray::kHeaderSize));
__ IncrementCounter(COUNTERS->keyed_load_generic_lookup_cache(), 1);
__ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
__ ret(0);
// Do a quick inline probe of the receiver's dictionary, if it
@ -675,7 +676,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
GenerateGlobalInstanceTypeCheck(masm, rcx, &slow);
GenerateDictionaryLoad(masm, &slow, rbx, rax, rcx, rdi, rax);
__ IncrementCounter(COUNTERS->keyed_load_generic_symbol(), 1);
__ IncrementCounter(counters->keyed_load_generic_symbol(), 1);
__ ret(0);
__ bind(&index_string);
@ -990,10 +991,11 @@ static void GenerateCallMiss(MacroAssembler* masm, int argc, IC::UtilityId id) {
// rsp[(argc + 1) * 8] : argument 0 = receiver
// -----------------------------------
Counters* counters = masm->isolate()->counters();
if (id == IC::kCallIC_Miss) {
__ IncrementCounter(COUNTERS->call_miss(), 1);
__ IncrementCounter(counters->call_miss(), 1);
} else {
__ IncrementCounter(COUNTERS->keyed_call_miss(), 1);
__ IncrementCounter(counters->keyed_call_miss(), 1);
}
// Get the receiver of the function from the stack; 1 ~ return address.
@ -1119,7 +1121,8 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
GenerateFastArrayLoad(
masm, rdx, rcx, rax, rbx, rdi, &check_number_dictionary, &slow_load);
__ IncrementCounter(COUNTERS->keyed_call_generic_smi_fast(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->keyed_call_generic_smi_fast(), 1);
__ bind(&do_call);
// receiver in rdx is not used after this point.
@ -1137,13 +1140,13 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ SmiToInteger32(rbx, rcx);
// ebx: untagged index
GenerateNumberDictionaryLoad(masm, &slow_load, rax, rcx, rbx, r9, rdi, rdi);
__ IncrementCounter(COUNTERS->keyed_call_generic_smi_dict(), 1);
__ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1);
__ jmp(&do_call);
__ bind(&slow_load);
// This branch is taken when calling KeyedCallIC_Miss is neither required
// nor beneficial.
__ IncrementCounter(COUNTERS->keyed_call_generic_slow_load(), 1);
__ IncrementCounter(counters->keyed_call_generic_slow_load(), 1);
__ EnterInternalFrame();
__ push(rcx); // save the key
__ push(rdx); // pass the receiver
@ -1170,11 +1173,11 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
__ j(not_equal, &lookup_monomorphic_cache);
GenerateDictionaryLoad(masm, &slow_load, rbx, rcx, rax, rdi, rdi);
__ IncrementCounter(COUNTERS->keyed_call_generic_lookup_dict(), 1);
__ IncrementCounter(counters->keyed_call_generic_lookup_dict(), 1);
__ jmp(&do_call);
__ bind(&lookup_monomorphic_cache);
__ IncrementCounter(COUNTERS->keyed_call_generic_lookup_cache(), 1);
__ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1);
GenerateMonomorphicCacheProbe(masm, argc, Code::KEYED_CALL_IC);
// Fall through on miss.
@ -1185,7 +1188,7 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
// - the value loaded is not a function,
// - there is hope that the runtime will create a monomorphic call stub
// that will get fetched next time.
__ IncrementCounter(COUNTERS->keyed_call_generic_slow(), 1);
__ IncrementCounter(counters->keyed_call_generic_slow(), 1);
GenerateMiss(masm, argc);
__ bind(&index_string);
@ -1279,7 +1282,8 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
// -- rsp[0] : return address
// -----------------------------------
__ IncrementCounter(COUNTERS->load_miss(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->load_miss(), 1);
__ pop(rbx);
__ push(rax); // receiver
@ -1424,7 +1428,8 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
// -- rsp[0] : return address
// -----------------------------------
__ IncrementCounter(COUNTERS->keyed_load_miss(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->keyed_load_miss(), 1);
__ pop(rbx);
__ push(rdx); // receiver
@ -1569,11 +1574,12 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) {
GenerateStringDictionaryReceiverCheck(masm, rdx, rbx, rdi, &miss);
GenerateDictionaryStore(masm, &miss, rbx, rcx, rax, r8, r9);
__ IncrementCounter(COUNTERS->store_normal_hit(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->store_normal_hit(), 1);
__ ret(0);
__ bind(&miss);
__ IncrementCounter(COUNTERS->store_normal_miss(), 1);
__ IncrementCounter(counters->store_normal_miss(), 1);
GenerateMiss(masm);
}

View File

@ -89,8 +89,9 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
Register r0,
Register r1) {
ASSERT(name->IsSymbol());
__ IncrementCounter(COUNTERS->negative_lookups(), 1);
__ IncrementCounter(COUNTERS->negative_lookups_miss(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->negative_lookups(), 1);
__ IncrementCounter(counters->negative_lookups_miss(), 1);
Label done;
__ movq(r0, FieldOperand(receiver, HeapObject::kMapOffset));
@ -173,7 +174,7 @@ static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
}
__ bind(&done);
__ DecrementCounter(COUNTERS->negative_lookups_miss(), 1);
__ DecrementCounter(counters->negative_lookups_miss(), 1);
}
@ -601,10 +602,11 @@ class CallInterceptorCompiler BASE_EMBEDDED {
(depth2 != kInvalidProtoDepth);
}
__ IncrementCounter(COUNTERS->call_const_interceptor(), 1);
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->call_const_interceptor(), 1);
if (can_do_fast_api_call) {
__ IncrementCounter(COUNTERS->call_const_interceptor_fast_api(), 1);
__ IncrementCounter(counters->call_const_interceptor_fast_api(), 1);
ReserveSpaceForFastApiCall(masm, scratch1);
}
@ -2006,8 +2008,9 @@ MaybeObject* CallStubCompiler::CompileFastApiCall(
// Check that the receiver isn't a smi.
__ JumpIfSmi(rdx, &miss_before_stack_reserved);
__ IncrementCounter(COUNTERS->call_const(), 1);
__ IncrementCounter(COUNTERS->call_const_fast_api(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->call_const(), 1);
__ IncrementCounter(counters->call_const_fast_api(), 1);
// Allocate space for v8::Arguments implicit values. Must be initialized
// before calling any runtime function.
@ -2077,10 +2080,11 @@ MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
// unless we're doing a receiver map check.
ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK);
Counters* counters = masm()->isolate()->counters();
SharedFunctionInfo* function_info = function->shared();
switch (check) {
case RECEIVER_MAP_CHECK:
__ IncrementCounter(COUNTERS->call_const(), 1);
__ IncrementCounter(counters->call_const(), 1);
// Check that the maps haven't changed.
CheckPrototypes(JSObject::cast(object), rdx, holder,
@ -2282,7 +2286,8 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
__ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
// Jump to the cached code (tail call).
__ IncrementCounter(COUNTERS->call_global_inline(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->call_global_inline(), 1);
ASSERT(function->is_compiled());
ParameterCount expected(function->shared()->formal_parameter_count());
if (V8::UseCrankshaft()) {
@ -2298,7 +2303,7 @@ MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
}
// Handle call cache miss.
__ bind(&miss);
__ IncrementCounter(COUNTERS->call_global_inline_miss(), 1);
__ IncrementCounter(counters->call_global_inline_miss(), 1);
MaybeObject* maybe_result = GenerateMissBranch();
if (maybe_result->IsFailure()) return maybe_result;
@ -2470,12 +2475,13 @@ MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
__ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), rax);
// Return the value (register rax).
__ IncrementCounter(COUNTERS->named_store_global_inline(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->named_store_global_inline(), 1);
__ ret(0);
// Handle store cache miss.
__ bind(&miss);
__ IncrementCounter(COUNTERS->named_store_global_inline_miss(), 1);
__ IncrementCounter(counters->named_store_global_inline_miss(), 1);
Handle<Code> ic(Isolate::Current()->builtins()->builtin(
Builtins::StoreIC_Miss));
__ Jump(ic, RelocInfo::CODE_TARGET);
@ -2497,7 +2503,8 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_store_field(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_store_field(), 1);
// Check that the name has not changed.
__ Cmp(rcx, Handle<String>(name));
@ -2513,7 +2520,7 @@ MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
// Handle store cache miss.
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_store_field(), 1);
__ DecrementCounter(counters->keyed_store_field(), 1);
Handle<Code> ic(Isolate::Current()->builtins()->builtin(
Builtins::KeyedStoreIC_Miss));
__ Jump(ic, RelocInfo::CODE_TARGET);
@ -2761,12 +2768,13 @@ MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
__ Check(not_equal, "DontDelete cells can't contain the hole");
}
__ IncrementCounter(COUNTERS->named_load_global_stub(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->named_load_global_stub(), 1);
__ movq(rax, rbx);
__ ret(0);
__ bind(&miss);
__ IncrementCounter(COUNTERS->named_load_global_stub_miss(), 1);
__ IncrementCounter(counters->named_load_global_stub_miss(), 1);
GenerateLoadMiss(masm(), Code::LOAD_IC);
// Return the generated code.
@ -2785,7 +2793,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_field(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_field(), 1);
// Check that the name has not changed.
__ Cmp(rax, Handle<String>(name));
@ -2794,7 +2803,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
GenerateLoadField(receiver, holder, rdx, rbx, rcx, rdi, index, name, &miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_field(), 1);
__ DecrementCounter(counters->keyed_load_field(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -2814,7 +2823,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback(
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_callback(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_callback(), 1);
// Check that the name has not changed.
__ Cmp(rax, Handle<String>(name));
@ -2829,7 +2839,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback(
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_callback(), 1);
__ DecrementCounter(counters->keyed_load_callback(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -2848,7 +2858,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_constant_function(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_constant_function(), 1);
// Check that the name has not changed.
__ Cmp(rax, Handle<String>(name));
@ -2857,7 +2868,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
GenerateLoadConstant(receiver, holder, rdx, rbx, rcx, rdi,
value, name, &miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_constant_function(), 1);
__ DecrementCounter(counters->keyed_load_constant_function(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -2875,7 +2886,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_interceptor(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_interceptor(), 1);
// Check that the name has not changed.
__ Cmp(rax, Handle<String>(name));
@ -2894,7 +2906,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
name,
&miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_interceptor(), 1);
__ DecrementCounter(counters->keyed_load_interceptor(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -2910,7 +2922,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_array_length(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_array_length(), 1);
// Check that the name has not changed.
__ Cmp(rax, Handle<String>(name));
@ -2918,7 +2931,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
GenerateLoadArrayLength(masm(), rdx, rcx, &miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_array_length(), 1);
__ DecrementCounter(counters->keyed_load_array_length(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -2934,7 +2947,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_string_length(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_string_length(), 1);
// Check that the name has not changed.
__ Cmp(rax, Handle<String>(name));
@ -2942,7 +2956,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
GenerateLoadStringLength(masm(), rdx, rcx, rbx, &miss, true);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_string_length(), 1);
__ DecrementCounter(counters->keyed_load_string_length(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -2958,7 +2972,8 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
// -----------------------------------
Label miss;
__ IncrementCounter(COUNTERS->keyed_load_function_prototype(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_function_prototype(), 1);
// Check that the name has not changed.
__ Cmp(rax, Handle<String>(name));
@ -2966,7 +2981,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
GenerateLoadFunctionPrototype(masm(), rdx, rcx, rbx, &miss);
__ bind(&miss);
__ DecrementCounter(COUNTERS->keyed_load_function_prototype(), 1);
__ DecrementCounter(counters->keyed_load_function_prototype(), 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
// Return the generated code.
@ -3135,8 +3150,9 @@ MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
__ pop(rcx);
__ lea(rsp, Operand(rsp, rbx, times_pointer_size, 1 * kPointerSize));
__ push(rcx);
__ IncrementCounter(COUNTERS->constructed_objects(), 1);
__ IncrementCounter(COUNTERS->constructed_objects_stub(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->constructed_objects(), 1);
__ IncrementCounter(counters->constructed_objects_stub(), 1);
__ ret(0);
// Jump to the generic stub in case the specialized code cannot handle the
@ -3258,7 +3274,8 @@ MaybeObject* ExternalArrayStubCompiler::CompileKeyedLoadStub(
// Slow case: Jump to runtime.
__ bind(&slow);
__ IncrementCounter(COUNTERS->keyed_load_external_array_slow(), 1);
Counters* counters = masm()->isolate()->counters();
__ IncrementCounter(counters->keyed_load_external_array_slow(), 1);
// ----------- S t a t e -------------
// -- rax : key