Revision: 23389
Author: [email protected]
Date: Tue Aug 26 09:19:24 2014 UTC
Log: Replace our homegrown ARRAY_SIZE() with Chrome's arraysize().
Our own ARRAY_SIZE() was pretty bad at error checking. If you use
arrasize() in a wrong way, the compiler will issue an error instead of
silently doing the wrong thing. The previous ARRAY_SIZE() macro is still
available as ARRAYSIZE_UNSAFE() similar to Chrome.
[email protected]
Review URL: https://codereview.chromium.org/501323002
https://code.google.com/p/v8/source/detail?r=23389
Modified:
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/arm/code-stubs-arm.cc
/branches/bleeding_edge/src/arm64/assembler-arm64.cc
/branches/bleeding_edge/src/arm64/code-stubs-arm64.cc
/branches/bleeding_edge/src/arm64/instrument-arm64.cc
/branches/bleeding_edge/src/arm64/simulator-arm64.cc
/branches/bleeding_edge/src/ast.cc
/branches/bleeding_edge/src/base/logging.cc
/branches/bleeding_edge/src/base/macros.h
/branches/bleeding_edge/src/bootstrapper.cc
/branches/bleeding_edge/src/cached-powers.cc
/branches/bleeding_edge/src/code-stubs.cc
/branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc
/branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc
/branches/bleeding_edge/src/compiler/graph-builder.h
/branches/bleeding_edge/src/compiler/graph.h
/branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc
/branches/bleeding_edge/src/compiler/instruction-selector.cc
/branches/bleeding_edge/src/compiler/js-generic-lowering.cc
/branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc
/branches/bleeding_edge/src/conversions.cc
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/src/deoptimizer.h
/branches/bleeding_edge/src/execution.cc
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/full-codegen.cc
/branches/bleeding_edge/src/global-handles.cc
/branches/bleeding_edge/src/heap/heap.cc
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/jsregexp.cc
/branches/bleeding_edge/src/lithium-codegen.cc
/branches/bleeding_edge/src/messages.cc
/branches/bleeding_edge/src/mips/code-stubs-mips.cc
/branches/bleeding_edge/src/mips64/code-stubs-mips64.cc
/branches/bleeding_edge/src/mksnapshot.cc
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/parser.cc
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/serialize.cc
/branches/bleeding_edge/src/strtod.cc
/branches/bleeding_edge/src/types.cc
/branches/bleeding_edge/src/vector.h
/branches/bleeding_edge/src/x64/code-stubs-x64.cc
/branches/bleeding_edge/src/x87/code-stubs-x87.cc
/branches/bleeding_edge/test/base-unittests/platform/platform-unittest.cc
/branches/bleeding_edge/test/cctest/compiler/call-tester.h
/branches/bleeding_edge/test/cctest/compiler/test-branch-combine.cc
/branches/bleeding_edge/test/cctest/compiler/test-instruction.cc
/branches/bleeding_edge/test/cctest/compiler/test-js-constant-cache.cc
/branches/bleeding_edge/test/cctest/compiler/test-js-typed-lowering.cc
/branches/bleeding_edge/test/cctest/compiler/test-node-cache.cc
/branches/bleeding_edge/test/cctest/compiler/test-phi-reducer.cc
/branches/bleeding_edge/test/cctest/compiler/test-representation-change.cc
/branches/bleeding_edge/test/cctest/compiler/test-run-machops.cc
/branches/bleeding_edge/test/cctest/compiler/test-simplified-lowering.cc
/branches/bleeding_edge/test/cctest/compiler/test-structured-ifbuilder-fuzzer.cc
/branches/bleeding_edge/test/cctest/compiler/test-structured-machine-assembler.cc
/branches/bleeding_edge/test/cctest/compiler/value-helper.h
/branches/bleeding_edge/test/cctest/test-api.cc
/branches/bleeding_edge/test/cctest/test-checks.cc
/branches/bleeding_edge/test/cctest/test-compiler.cc
/branches/bleeding_edge/test/cctest/test-cpu-profiler.cc
/branches/bleeding_edge/test/cctest/test-date.cc
/branches/bleeding_edge/test/cctest/test-debug.cc
/branches/bleeding_edge/test/cctest/test-heap-profiler.cc
/branches/bleeding_edge/test/cctest/test-mark-compact.cc
/branches/bleeding_edge/test/cctest/test-object-observe.cc
/branches/bleeding_edge/test/cctest/test-parsing.cc
/branches/bleeding_edge/test/cctest/test-random-number-generator.cc
/branches/bleeding_edge/testing/gtest-support.h
=======================================
--- /branches/bleeding_edge/src/api.cc Mon Aug 25 11:34:43 2014 UTC
+++ /branches/bleeding_edge/src/api.cc Tue Aug 26 09:19:24 2014 UTC
@@ -2065,7 +2065,7 @@
i::Handle<i::Object> argv[] = { data };
return CallV8HeapFunction(name,
i::Isolate::Current()->js_builtins_object(),
- ARRAY_SIZE(argv),
+ arraysize(argv),
argv);
}
@@ -2967,7 +2967,7 @@
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> result;
has_pending_exception = !CallV8HeapFunction(
- "EQUALS", obj, ARRAY_SIZE(args), args).ToHandle(&result);
+ "EQUALS", obj, arraysize(args), args).ToHandle(&result);
EXCEPTION_BAILOUT_CHECK(isolate, false);
return *result == i::Smi::FromInt(i::EQUAL);
}
@@ -3196,7 +3196,7 @@
has_pending_exception = !CallV8HeapFunction(
"ObjectGetOwnPropertyDescriptor",
isolate->factory()->undefined_value(),
- ARRAY_SIZE(args),
+ arraysize(args),
args).ToHandle(&result);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
return Utils::ToLocal(result);
@@ -5735,7 +5735,7 @@
if ((flags & RegExp::kGlobal) != 0) flags_buf[num_flags++] = 'g';
if ((flags & RegExp::kMultiline) != 0) flags_buf[num_flags++] = 'm';
if ((flags & RegExp::kIgnoreCase) != 0) flags_buf[num_flags++] = 'i';
- DCHECK(num_flags <= static_cast<int>(ARRAY_SIZE(flags_buf)));
+ DCHECK(num_flags <= static_cast<int>(arraysize(flags_buf)));
return isolate->factory()->InternalizeOneByteString(
i::Vector<const uint8_t>(flags_buf, num_flags));
}
@@ -5841,7 +5841,7 @@
isolate,
isolate->is_promise(),
isolate->factory()->undefined_value(),
- ARRAY_SIZE(argv), argv,
+ arraysize(argv), argv,
false).ToHandle(&b);
EXCEPTION_BAILOUT_CHECK(isolate, false);
return b->BooleanValue();
@@ -5882,7 +5882,7 @@
isolate,
isolate->promise_resolve(),
isolate->factory()->undefined_value(),
- ARRAY_SIZE(argv), argv,
+ arraysize(argv), argv,
false).is_null();
EXCEPTION_BAILOUT_CHECK(isolate, /* void */ ;);
}
@@ -5899,7 +5899,7 @@
isolate,
isolate->promise_reject(),
isolate->factory()->undefined_value(),
- ARRAY_SIZE(argv), argv,
+ arraysize(argv), argv,
false).is_null();
EXCEPTION_BAILOUT_CHECK(isolate, /* void */ ;);
}
@@ -5917,7 +5917,7 @@
isolate,
isolate->promise_chain(),
promise,
- ARRAY_SIZE(argv), argv,
+ arraysize(argv), argv,
false).ToHandle(&result);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>());
return Local<Promise>::Cast(Utils::ToLocal(result));
@@ -5936,7 +5936,7 @@
isolate,
isolate->promise_catch(),
promise,
- ARRAY_SIZE(argv), argv,
+ arraysize(argv), argv,
false).ToHandle(&result);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>());
return Local<Promise>::Cast(Utils::ToLocal(result));
@@ -5955,7 +5955,7 @@
isolate,
isolate->promise_then(),
promise,
- ARRAY_SIZE(argv), argv,
+ arraysize(argv), argv,
false).ToHandle(&result);
EXCEPTION_BAILOUT_CHECK(isolate, Local<Promise>());
return Local<Promise>::Cast(Utils::ToLocal(result));
@@ -7575,7 +7575,7 @@
}
List<Context*>* context_lists[2] = { &saved_contexts_,
&entered_contexts_};
- for (unsigned i = 0; i < ARRAY_SIZE(context_lists); i++) {
+ for (unsigned i = 0; i < arraysize(context_lists); i++) {
if (context_lists[i]->is_empty()) continue;
Object** start =
reinterpret_cast<Object**>(&context_lists[i]->first());
v->VisitPointers(start, start + context_lists[i]->length());
=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Mon Aug 25 13:09:02
2014 UTC
+++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Aug 26 09:19:24
2014 UTC
@@ -23,7 +23,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r2 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
}
@@ -31,14 +31,14 @@
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r1 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void ToNumberStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -46,7 +46,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
}
@@ -60,7 +60,7 @@
Representation::Smi(),
Representation::Tagged() };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry,
representations);
}
@@ -70,7 +70,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r3, r2, r1, r0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
}
@@ -78,7 +78,7 @@
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r2, r3 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -86,7 +86,7 @@
CodeStubInterfaceDescriptor* descriptor) {
// r1 function the function to call
Register registers[] = {cp, r1};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -100,7 +100,7 @@
// TODO(turbofan): So far we don't gather type feedback and hence skip
the
// slot parameter, but ArrayConstructStub needs the vector to be
undefined.
Register registers[] = {cp, r0, r1, r2};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -108,7 +108,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r2, r1, r0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
}
@@ -118,7 +118,7 @@
Register registers[] = { cp, r0, r1 };
Address entry =
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry;
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(entry));
}
@@ -126,7 +126,7 @@
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
@@ -149,7 +149,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { cp, r1, r2 };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -160,7 +160,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, r0,
+ descriptor->Initialize(major, arraysize(registers), registers, r0,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -180,7 +180,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { cp, r1 };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -190,7 +190,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, r0,
+ descriptor->Initialize(major, arraysize(registers), registers, r0,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -219,7 +219,7 @@
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
@@ -247,7 +247,7 @@
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r1, r0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
@@ -257,7 +257,7 @@
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r2, r1, r0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
@@ -265,7 +265,7 @@
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, r1, r0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
@@ -291,7 +291,7 @@
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &default_descriptor);
}
{
@@ -304,7 +304,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &noInlineDescriptor);
}
{
@@ -317,7 +317,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &noInlineDescriptor);
}
{
@@ -330,7 +330,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &default_descriptor);
}
{
@@ -349,7 +349,7 @@
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &default_descriptor);
}
}
=======================================
--- /branches/bleeding_edge/src/arm64/assembler-arm64.cc Thu Aug 7
10:46:40 2014 UTC
+++ /branches/bleeding_edge/src/arm64/assembler-arm64.cc Tue Aug 26
09:19:24 2014 UTC
@@ -227,7 +227,7 @@
const CPURegister regs[] = {reg1, reg2, reg3, reg4, reg5, reg6, reg7,
reg8};
- for (unsigned i = 0; i < ARRAY_SIZE(regs); i++) {
+ for (unsigned i = 0; i < arraysize(regs); i++) {
if (regs[i].IsRegister()) {
number_of_valid_regs++;
unique_regs |= regs[i].Bit();
@@ -2664,7 +2664,7 @@
int multiplier_idx = CountLeadingZeros(d, kXRegSizeInBits) - 57;
// Ensure that the index to the multipliers array is within bounds.
DCHECK((multiplier_idx >= 0) &&
- (static_cast<size_t>(multiplier_idx) < ARRAY_SIZE(multipliers)));
+ (static_cast<size_t>(multiplier_idx) < arraysize(multipliers)));
uint64_t multiplier = multipliers[multiplier_idx];
uint64_t candidate = (b - a) * multiplier;
=======================================
--- /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Mon Aug 25
13:09:02 2014 UTC
+++ /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Tue Aug 26
09:19:24 2014 UTC
@@ -24,7 +24,7 @@
// x2: function info
Register registers[] = { cp, x2 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
}
@@ -34,7 +34,7 @@
// cp: context
// x1: function
Register registers[] = { cp, x1 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -43,7 +43,7 @@
// cp: context
// x0: value
Register registers[] = { cp, x0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -53,7 +53,7 @@
// x0: value
Register registers[] = { cp, x0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
}
@@ -71,7 +71,7 @@
Representation::Smi(),
Representation::Tagged() };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry,
representations);
}
@@ -86,7 +86,7 @@
// x0: object literal flags
Register registers[] = { cp, x3, x2, x1, x0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
}
@@ -97,7 +97,7 @@
// x2: feedback vector
// x3: call feedback slot
Register registers[] = { cp, x2, x3 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -105,7 +105,7 @@
CodeStubInterfaceDescriptor* descriptor) {
// x1 function the function to call
Register registers[] = {cp, x1};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -118,7 +118,7 @@
// TODO(turbofan): So far we don't gather type feedback and hence skip
the
// slot parameter, but ArrayConstructStub needs the vector to be
undefined.
Register registers[] = {cp, x0, x1, x2};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -130,7 +130,7 @@
// x0: string
Register registers[] = { cp, x2, x1, x0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
}
@@ -143,7 +143,7 @@
Register registers[] = { cp, x0, x1 };
Address entry =
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry;
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(entry));
}
@@ -153,7 +153,7 @@
// cp: context
// x0: value to compare
Register registers[] = { cp, x0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
@@ -175,7 +175,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { cp, x1, x2 };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -186,7 +186,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, x0,
+ descriptor->Initialize(major, arraysize(registers), registers, x0,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -223,7 +223,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { cp, x1 };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -233,7 +233,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, x0,
+ descriptor->Initialize(major, arraysize(registers), registers, x0,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -264,7 +264,7 @@
// cp: context
// x0: value
Register registers[] = { cp, x0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
@@ -277,7 +277,7 @@
// x1: left operand
// x0: right operand
Register registers[] = { cp, x1, x0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
@@ -291,7 +291,7 @@
// x1: left operand
// x0: right operand
Register registers[] = { cp, x2, x1, x0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
@@ -302,7 +302,7 @@
// x1: left operand
// x0: right operand
Register registers[] = { cp, x1, x0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
@@ -328,7 +328,7 @@
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &default_descriptor);
}
{
@@ -341,7 +341,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &noInlineDescriptor);
}
{
@@ -354,7 +354,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &noInlineDescriptor);
}
{
@@ -367,7 +367,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &default_descriptor);
}
{
@@ -386,7 +386,7 @@
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(arraysize(registers), registers,
representations, &default_descriptor);
}
}
=======================================
--- /branches/bleeding_edge/src/arm64/instrument-arm64.cc Mon Aug 4
12:46:43 2014 UTC
+++ /branches/bleeding_edge/src/arm64/instrument-arm64.cc Tue Aug 26
09:19:24 2014 UTC
@@ -107,7 +107,7 @@
}
}
- static const int num_counters = ARRAY_SIZE(kCounterList);
+ static const int num_counters = arraysize(kCounterList);
// Dump an instrumentation description comment at the top of the file.
fprintf(output_stream_, "# counters=%d\n", num_counters);
=======================================
--- /branches/bleeding_edge/src/arm64/simulator-arm64.cc Wed Aug 20
15:25:13 2014 UTC
+++ /branches/bleeding_edge/src/arm64/simulator-arm64.cc Tue Aug 26
09:19:24 2014 UTC
@@ -1065,7 +1065,7 @@
"0b10 (Round towards Minus Infinity)",
"0b11 (Round towards Zero)"
};
- DCHECK(fpcr().RMode() < ARRAY_SIZE(rmode));
+ DCHECK(fpcr().RMode() < arraysize(rmode));
fprintf(stream_, "# %sFPCR: %sAHP:%d DN:%d FZ:%d RMode:%s%s\n",
clr_flag_name,
clr_flag_value,
=======================================
--- /branches/bleeding_edge/src/ast.cc Fri Aug 22 11:12:29 2014 UTC
+++ /branches/bleeding_edge/src/ast.cc Tue Aug 26 09:19:24 2014 UTC
@@ -1119,7 +1119,7 @@
if (value_->IsString()) return value_->AsString()->string();
DCHECK(value_->IsNumber());
char arr[100];
- Vector<char> buffer(arr, ARRAY_SIZE(arr));
+ Vector<char> buffer(arr, arraysize(arr));
const char* str;
if (value()->IsSmi()) {
// Optimization only, the heap number case would subsume this.
=======================================
--- /branches/bleeding_edge/src/base/logging.cc Mon Jun 30 13:25:46 2014 UTC
+++ /branches/bleeding_edge/src/base/logging.cc Tue Aug 26 09:19:24 2014 UTC
@@ -22,7 +22,7 @@
void DumpBacktrace() {
#if V8_LIBC_GLIBC || V8_OS_BSD
void* trace[100];
- int size = backtrace(trace, ARRAY_SIZE(trace));
+ int size = backtrace(trace, arraysize(trace));
char** symbols = backtrace_symbols(trace, size);
OS::PrintError("\n==== C stack trace
===============================\n\n");
if (size == 0) {
@@ -54,7 +54,7 @@
bt_sprn_memmap(&memmap, out, sizeof(out));
OS::PrintError(out);
bt_addr_t trace[100];
- int size = bt_get_backtrace(&acc, trace, ARRAY_SIZE(trace));
+ int size = bt_get_backtrace(&acc, trace, arraysize(trace));
OS::PrintError("\n==== C stack trace
===============================\n\n");
if (size == 0) {
OS::PrintError("(empty)\n");
=======================================
--- /branches/bleeding_edge/src/base/macros.h Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/base/macros.h Tue Aug 26 09:19:24 2014 UTC
@@ -20,13 +20,74 @@
(reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4)
-// The expression ARRAY_SIZE(a) is a compile-time constant of type
-// size_t which represents the number of elements of the given
-// array. You should only use ARRAY_SIZE on statically allocated
-// arrays.
-#define ARRAY_SIZE(a) \
- ((sizeof(a) / sizeof(*(a))) / \
- static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
+// The arraysize(arr) macro returns the # of elements in an array arr.
+// The expression is a compile-time constant, and therefore can be
+// used in defining new arrays, for example. If you use arraysize on
+// a pointer by mistake, you will get a compile-time error.
+//
+// One caveat is that arraysize() doesn't accept any array of an
+// anonymous type or a type defined inside a function. In these rare
+// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This
is
+// due to a limitation in C++'s template system. The limitation might
+// eventually be removed, but it hasn't happened yet.
+#define arraysize(array) (sizeof(ArraySizeHelper(array)))
+
+
+// This template function declaration is used in defining arraysize.
+// Note that the function doesn't need an implementation, as we only
+// use its type.
+template <typename T, size_t N>
+char (&ArraySizeHelper(T (&array)[N]))[N];
+
+
+#if V8_CC_GNU
+// That gcc wants both of these prototypes seems mysterious. VC, for
+// its part, can't decide which to use (another mystery). Matching of
+// template overloads: the final frontier.
+template <typename T, size_t N>
+char (&ArraySizeHelper(const T (&array)[N]))[N];
+#endif
+
+
+// ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize,
+// but can be used on anonymous types or types defined inside
+// functions. It's less safe than arraysize as it accepts some
+// (although not all) pointers. Therefore, you should use arraysize
+// whenever possible.
+//
+// The expression ARRAYSIZE_UNSAFE(a) is a compile-time constant of type
+// size_t.
+//
+// ARRAYSIZE_UNSAFE catches a few type errors. If you see a compiler error
+//
+// "warning: division by zero in ..."
+//
+// when using ARRAYSIZE_UNSAFE, you are (wrongfully) giving it a pointer.
+// You should only use ARRAYSIZE_UNSAFE on statically allocated arrays.
+//
+// The following comments are on the implementation details, and can
+// be ignored by the users.
+//
+// ARRAYSIZE_UNSAFE(arr) works by inspecting sizeof(arr) (the # of bytes in
+// the array) and sizeof(*(arr)) (the # of bytes in one array
+// element). If the former is divisible by the latter, perhaps arr is
+// indeed an array, in which case the division result is the # of
+// elements in the array. Otherwise, arr cannot possibly be an array,
+// and we generate a compiler error to prevent the code from
+// compiling.
+//
+// Since the size of bool is implementation-defined, we need to cast
+// !(sizeof(a) & sizeof(*(a))) to size_t in order to ensure the final
+// result has type size_t.
+//
+// This macro is not perfect as it wrongfully accepts certain
+// pointers, namely where the pointer size is divisible by the pointee
+// size. Since all our code has to go through a 32-bit compiler,
+// where a pointer is 4 bytes, this means all pointers to a type whose
+// size is 3 or greater than 4 will be (righteously) rejected.
+#define ARRAYSIZE_UNSAFE(a) \
+ ((sizeof(a) / sizeof(*(a))) / \
+ static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) // NOLINT
// A macro to disallow the evil copy constructor and operator= functions
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Mon Aug 25 11:34:43 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Tue Aug 26 09:19:24 2014 UTC
@@ -2682,7 +2682,7 @@
NONE).Assert();
// Initialize trigonometric lookup tables and constants.
- const int constants_size =
ARRAY_SIZE(fdlibm::MathConstants::constants);
+ const int constants_size = arraysize(fdlibm::MathConstants::constants);
const int table_num_bytes = constants_size * kDoubleSize;
v8::Local<v8::ArrayBuffer> trig_buffer = v8::ArrayBuffer::New(
reinterpret_cast<v8::Isolate*>(isolate),
=======================================
--- /branches/bleeding_edge/src/cached-powers.cc Mon Aug 4 11:34:54 2014
UTC
+++ /branches/bleeding_edge/src/cached-powers.cc Tue Aug 26 09:19:24 2014
UTC
@@ -111,7 +111,7 @@
};
#ifdef DEBUG
-static const int kCachedPowersLength = ARRAY_SIZE(kCachedPowers);
+static const int kCachedPowersLength = arraysize(kCachedPowers);
#endif
static const int kCachedPowersOffset = 348; // -1 * the first
decimal_exponent.
=======================================
--- /branches/bleeding_edge/src/code-stubs.cc Mon Aug 25 13:09:02 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.cc Tue Aug 26 09:19:24 2014 UTC
@@ -585,7 +585,7 @@
LoadIC::ReceiverRegister(),
LoadIC::NameRegister() };
STATIC_ASSERT(LoadIC::kParameterCount == 2);
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure));
}
@@ -596,7 +596,7 @@
LoadIC::ReceiverRegister(),
LoadIC::NameRegister() };
STATIC_ASSERT(LoadIC::kParameterCount == 2);
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure));
}
@@ -608,7 +608,7 @@
LoadIC::NameRegister() };
STATIC_ASSERT(LoadIC::kParameterCount == 2);
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry);
}
@@ -618,13 +618,13 @@
if (kind() == Code::LOAD_IC) {
Register registers[] = {InterfaceDescriptor::ContextRegister(),
LoadIC::ReceiverRegister(),
LoadIC::NameRegister()};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
} else {
DCHECK_EQ(Code::STORE_IC, kind());
Register registers[] = {InterfaceDescriptor::ContextRegister(),
StoreIC::ReceiverRegister(),
StoreIC::NameRegister(),
StoreIC::ValueRegister()};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(StoreIC_MissFromStubFailure));
}
}
@@ -636,7 +636,7 @@
KeyedStoreIC::ReceiverRegister(),
KeyedStoreIC::NameRegister(),
KeyedStoreIC::ValueRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure));
}
@@ -648,7 +648,7 @@
MapRegister(),
KeyRegister(),
ObjectRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss));
}
@@ -658,7 +658,7 @@
Register registers[] = { InterfaceDescriptor::ContextRegister(),
InstanceofStub::left(),
InstanceofStub::right() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
=======================================
--- /branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc
Tue Aug 26 08:30:18 2014 UTC
+++ /branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc
Tue Aug 26 09:19:24 2014 UTC
@@ -272,8 +272,8 @@
DCHECK_NE(0, input_count);
DCHECK_NE(0, output_count);
- DCHECK_GE(ARRAY_SIZE(inputs), input_count);
- DCHECK_GE(ARRAY_SIZE(outputs), output_count);
+ DCHECK_GE(arraysize(inputs), input_count);
+ DCHECK_GE(arraysize(outputs), output_count);
DCHECK_NE(kMode_None, AddressingModeField::decode(opcode));
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count,
@@ -345,7 +345,7 @@
// TODO(dcarney): handle immediate indices.
InstructionOperand* temps[] = {g.TempRegister(r5), g.TempRegister(r6)};
Emit(kArmStoreWriteBarrier, NULL, g.UseFixed(base, r4),
- g.UseFixed(index, r5), g.UseFixed(value, r6), ARRAY_SIZE(temps),
+ g.UseFixed(index, r5), g.UseFixed(value, r6), arraysize(temps),
temps);
return;
}
@@ -502,8 +502,8 @@
DCHECK_NE(0, input_count);
DCHECK_NE(0, output_count);
- DCHECK_GE(ARRAY_SIZE(inputs), input_count);
- DCHECK_GE(ARRAY_SIZE(outputs), output_count);
+ DCHECK_GE(arraysize(inputs), input_count);
+ DCHECK_GE(arraysize(outputs), output_count);
DCHECK_NE(kMode_None, AddressingModeField::decode(opcode));
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count,
@@ -890,8 +890,8 @@
}
DCHECK_NE(0, input_count);
- DCHECK_GE(ARRAY_SIZE(inputs), input_count);
- DCHECK_GE(ARRAY_SIZE(outputs), output_count);
+ DCHECK_GE(arraysize(inputs), input_count);
+ DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count,
outputs, input_count, inputs);
=======================================
---
/branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc
Tue Aug 26 08:30:18 2014 UTC
+++
/branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc
Tue Aug 26 09:19:24 2014 UTC
@@ -124,8 +124,8 @@
DCHECK_NE(0, input_count);
DCHECK_NE(0, output_count);
- DCHECK_GE(ARRAY_SIZE(inputs), input_count);
- DCHECK_GE(ARRAY_SIZE(outputs), output_count);
+ DCHECK_GE(arraysize(inputs), input_count);
+ DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count,
outputs, input_count, inputs);
@@ -198,7 +198,7 @@
// TODO(dcarney): handle immediate indices.
InstructionOperand* temps[] = {g.TempRegister(x11),
g.TempRegister(x12)};
Emit(kArm64StoreWriteBarrier, NULL, g.UseFixed(base, x10),
- g.UseFixed(index, x11), g.UseFixed(value, x12), ARRAY_SIZE(temps),
+ g.UseFixed(index, x11), g.UseFixed(value, x12), arraysize(temps),
temps);
return;
}
=======================================
--- /branches/bleeding_edge/src/compiler/graph-builder.h Fri Aug 8
13:51:30 2014 UTC
+++ /branches/bleeding_edge/src/compiler/graph-builder.h Tue Aug 26
09:19:24 2014 UTC
@@ -32,29 +32,29 @@
Node* NewNode(Operator* op, Node* n1, Node* n2) {
Node* buffer[] = {n1, n2};
- return MakeNode(op, ARRAY_SIZE(buffer), buffer);
+ return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3) {
Node* buffer[] = {n1, n2, n3};
- return MakeNode(op, ARRAY_SIZE(buffer), buffer);
+ return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) {
Node* buffer[] = {n1, n2, n3, n4};
- return MakeNode(op, ARRAY_SIZE(buffer), buffer);
+ return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5) {
Node* buffer[] = {n1, n2, n3, n4, n5};
- return MakeNode(op, ARRAY_SIZE(buffer), buffer);
+ return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5,
Node* n6) {
Node* nodes[] = {n1, n2, n3, n4, n5, n6};
- return MakeNode(op, ARRAY_SIZE(nodes), nodes);
+ return MakeNode(op, arraysize(nodes), nodes);
}
Node* NewNode(Operator* op, int value_input_count, Node** value_inputs) {
=======================================
--- /branches/bleeding_edge/src/compiler/graph.h Mon Aug 4 11:34:54 2014
UTC
+++ /branches/bleeding_edge/src/compiler/graph.h Tue Aug 26 09:19:24 2014
UTC
@@ -34,25 +34,25 @@
Node* NewNode(Operator* op, Node* n1) { return NewNode(op, 1, &n1); }
Node* NewNode(Operator* op, Node* n1, Node* n2) {
Node* nodes[] = {n1, n2};
- return NewNode(op, ARRAY_SIZE(nodes), nodes);
+ return NewNode(op, arraysize(nodes), nodes);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3) {
Node* nodes[] = {n1, n2, n3};
- return NewNode(op, ARRAY_SIZE(nodes), nodes);
+ return NewNode(op, arraysize(nodes), nodes);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) {
Node* nodes[] = {n1, n2, n3, n4};
- return NewNode(op, ARRAY_SIZE(nodes), nodes);
+ return NewNode(op, arraysize(nodes), nodes);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5) {
Node* nodes[] = {n1, n2, n3, n4, n5};
- return NewNode(op, ARRAY_SIZE(nodes), nodes);
+ return NewNode(op, arraysize(nodes), nodes);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5,
Node* n6) {
Node* nodes[] = {n1, n2, n3, n4, n5, n6};
- return NewNode(op, ARRAY_SIZE(nodes), nodes);
+ return NewNode(op, arraysize(nodes), nodes);
}
void ChangeOperator(Node* node, Operator* op);
=======================================
--- /branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc
Tue Aug 26 08:30:18 2014 UTC
+++ /branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc
Tue Aug 26 09:19:24 2014 UTC
@@ -106,7 +106,7 @@
// TODO(dcarney): handle immediate indices.
InstructionOperand* temps[] = {g.TempRegister(ecx),
g.TempRegister(edx)};
Emit(kIA32StoreWriteBarrier, NULL, g.UseFixed(base, ebx),
- g.UseFixed(index, ecx), g.UseFixed(value, edx), ARRAY_SIZE(temps),
+ g.UseFixed(index, ecx), g.UseFixed(value, edx), arraysize(temps),
temps);
return;
}
@@ -195,8 +195,8 @@
DCHECK_NE(0, input_count);
DCHECK_NE(0, output_count);
- DCHECK_GE(ARRAY_SIZE(inputs), input_count);
- DCHECK_GE(ARRAY_SIZE(outputs), output_count);
+ DCHECK_GE(arraysize(inputs), input_count);
+ DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count,
outputs, input_count, inputs);
@@ -316,7 +316,7 @@
ArchOpcode opcode) {
IA32OperandGenerator g(selector);
InstructionOperand* temps[] = {g.TempRegister(edx)};
- size_t temp_count = ARRAY_SIZE(temps);
+ size_t temp_count = arraysize(temps);
selector->Emit(opcode, g.DefineAsFixed(node, eax),
g.UseFixed(node->InputAt(0), eax),
g.UseUnique(node->InputAt(1)), temp_count, temps);
@@ -337,7 +337,7 @@
ArchOpcode opcode) {
IA32OperandGenerator g(selector);
InstructionOperand* temps[] = {g.TempRegister(eax), g.TempRegister(edx)};
- size_t temp_count = ARRAY_SIZE(temps);
+ size_t temp_count = arraysize(temps);
selector->Emit(opcode, g.DefineAsFixed(node, edx),
g.UseFixed(node->InputAt(0), eax),
g.UseUnique(node->InputAt(1)), temp_count, temps);
=======================================
--- /branches/bleeding_edge/src/compiler/instruction-selector.cc Tue Aug 26
08:30:18 2014 UTC
+++ /branches/bleeding_edge/src/compiler/instruction-selector.cc Tue Aug 26
09:19:24 2014 UTC
@@ -91,7 +91,7 @@
InstructionOperand** temps) {
size_t output_count = output == NULL ? 0 : 1;
InstructionOperand* inputs[] = {a, b};
- size_t input_count = ARRAY_SIZE(inputs);
+ size_t input_count = arraysize(inputs);
return Emit(opcode, output_count, &output, input_count, inputs,
temp_count,
temps);
}
@@ -105,7 +105,7 @@
InstructionOperand** temps) {
size_t output_count = output == NULL ? 0 : 1;
InstructionOperand* inputs[] = {a, b, c};
- size_t input_count = ARRAY_SIZE(inputs);
+ size_t input_count = arraysize(inputs);
return Emit(opcode, output_count, &output, input_count, inputs,
temp_count,
temps);
}
@@ -117,7 +117,7 @@
size_t temp_count, InstructionOperand** temps) {
size_t output_count = output == NULL ? 0 : 1;
InstructionOperand* inputs[] = {a, b, c, d};
- size_t input_count = ARRAY_SIZE(inputs);
+ size_t input_count = arraysize(inputs);
return Emit(opcode, output_count, &output, input_count, inputs,
temp_count,
temps);
}
=======================================
--- /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Thu Aug 21
11:56:46 2014 UTC
+++ /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Tue Aug 26
09:19:24 2014 UTC
@@ -49,7 +49,7 @@
Register registers[] = { InterfaceDescriptor::ContextRegister(),
LoadIC::ReceiverRegister(),
LoadIC::NameRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
private:
@@ -79,7 +79,7 @@
Register registers[] = { InterfaceDescriptor::ContextRegister(),
KeyedLoadIC::ReceiverRegister(),
KeyedLoadIC::NameRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
private:
@@ -109,7 +109,7 @@
StoreIC::ReceiverRegister(),
StoreIC::NameRegister(),
StoreIC::ValueRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
private:
@@ -143,7 +143,7 @@
KeyedStoreIC::ReceiverRegister(),
KeyedStoreIC::NameRegister(),
KeyedStoreIC::ValueRegister() };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
private:
=======================================
--- /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc
Tue Aug 26 08:30:18 2014 UTC
+++ /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc
Tue Aug 26 09:19:24 2014 UTC
@@ -119,7 +119,7 @@
// TODO(dcarney): handle immediate indices.
InstructionOperand* temps[] = {g.TempRegister(rcx),
g.TempRegister(rdx)};
Emit(kX64StoreWriteBarrier, NULL, g.UseFixed(base, rbx),
- g.UseFixed(index, rcx), g.UseFixed(value, rdx), ARRAY_SIZE(temps),
+ g.UseFixed(index, rcx), g.UseFixed(value, rdx), arraysize(temps),
temps);
return;
}
@@ -206,8 +206,8 @@
DCHECK_NE(0, input_count);
DCHECK_NE(0, output_count);
- DCHECK_GE(ARRAY_SIZE(inputs), input_count);
- DCHECK_GE(ARRAY_SIZE(outputs), output_count);
+ DCHECK_GE(arraysize(inputs), input_count);
+ DCHECK_GE(arraysize(outputs), output_count);
Instruction* instr = selector->Emit(cont->Encode(opcode), output_count,
outputs, input_count, inputs);
@@ -428,7 +428,7 @@
InstructionOperand* temps[] = {g.TempRegister(rdx)};
selector->Emit(
opcode, g.DefineAsFixed(node, rax), g.UseFixed(node->InputAt(0),
rax),
- g.UseUniqueRegister(node->InputAt(1)), ARRAY_SIZE(temps), temps);
+ g.UseUniqueRegister(node->InputAt(1)), arraysize(temps), temps);
}
@@ -458,7 +458,7 @@
InstructionOperand* temps[] = {g.TempRegister(rax), g.TempRegister(rdx)};
selector->Emit(
opcode, g.DefineAsFixed(node, rdx), g.UseFixed(node->InputAt(0),
rax),
- g.UseUniqueRegister(node->InputAt(1)), ARRAY_SIZE(temps), temps);
+ g.UseUniqueRegister(node->InputAt(1)), arraysize(temps), temps);
}
=======================================
--- /branches/bleeding_edge/src/conversions.cc Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/conversions.cc Tue Aug 26 09:19:24 2014 UTC
@@ -211,7 +211,7 @@
// use the non-fixed conversion routine.
if (abs_value >= kFirstNonFixed) {
char arr[100];
- Vector<char> buffer(arr, ARRAY_SIZE(arr));
+ Vector<char> buffer(arr, arraysize(arr));
return StrDup(DoubleToCString(value, buffer));
}
=======================================
--- /branches/bleeding_edge/src/debug.cc Fri Aug 22 11:43:39 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc Tue Aug 26 09:19:24 2014 UTC
@@ -1051,7 +1051,7 @@
Handle<Object> result;
if (!Execution::TryCall(check_break_point,
isolate_->js_builtins_object(),
- ARRAY_SIZE(argv),
+ arraysize(argv),
argv).ToHandle(&result)) {
return false;
}
@@ -2458,7 +2458,7 @@
MaybeHandle<Object> Debug::MakeExecutionState() {
// Create the execution state object.
Handle<Object> argv[] = {
isolate_->factory()->NewNumberFromInt(break_id()) };
- return MakeJSObject("MakeExecutionState", ARRAY_SIZE(argv), argv);
+ return MakeJSObject("MakeExecutionState", arraysize(argv), argv);
}
@@ -2466,7 +2466,7 @@
// Create the new break event object.
Handle<Object> argv[] = {
isolate_->factory()->NewNumberFromInt(break_id()),
break_points_hit };
- return MakeJSObject("MakeBreakEvent", ARRAY_SIZE(argv), argv);
+ return MakeJSObject("MakeBreakEvent", arraysize(argv), argv);
}
@@ -2478,7 +2478,7 @@
exception,
isolate_->factory()->ToBoolean(uncaught),
promise };
- return MakeJSObject("MakeExceptionEvent", ARRAY_SIZE(argv), argv);
+ return MakeJSObject("MakeExceptionEvent", arraysize(argv), argv);
}
@@ -2488,21 +2488,21 @@
Handle<Object> script_wrapper = Script::GetWrapper(script);
Handle<Object> argv[] = { script_wrapper,
isolate_->factory()->NewNumberFromInt(type) };
- return MakeJSObject("MakeCompileEvent", ARRAY_SIZE(argv), argv);
+ return MakeJSObject("MakeCompileEvent", arraysize(argv), argv);
}
MaybeHandle<Object> Debug::MakePromiseEvent(Handle<JSObject> event_data) {
// Create the promise event object.
Handle<Object> argv[] = { event_data };
- return MakeJSObject("MakePromiseEvent", ARRAY_SIZE(argv), argv);
+ return MakeJSObject("MakePromiseEvent", arraysize(argv), argv);
}
MaybeHandle<Object> Debug::MakeAsyncTaskEvent(Handle<JSObject> task_event)
{
// Create the async task event object.
Handle<Object> argv[] = { task_event };
- return MakeJSObject("MakeAsyncTaskEvent", ARRAY_SIZE(argv), argv);
+ return MakeJSObject("MakeAsyncTaskEvent", arraysize(argv), argv);
}
@@ -2648,7 +2648,7 @@
Handle<Object> argv[] = { wrapper };
if
(Execution::TryCall(Handle<JSFunction>::cast(update_script_break_points),
isolate_->js_builtins_object(),
- ARRAY_SIZE(argv),
+ arraysize(argv),
argv).is_null()) {
return;
}
@@ -2765,7 +2765,7 @@
event_listener_data_ };
Handle<JSReceiver> global(isolate_->global_proxy());
Execution::TryCall(Handle<JSFunction>::cast(event_listener_),
- global, ARRAY_SIZE(argv), argv);
+ global, arraysize(argv), argv);
}
}
@@ -3004,7 +3004,7 @@
isolate_,
fun,
Handle<Object>(debug_context()->global_proxy(), isolate_),
- ARRAY_SIZE(argv),
+ arraysize(argv),
argv);
}
=======================================
--- /branches/bleeding_edge/src/deoptimizer.h Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/deoptimizer.h Tue Aug 26 09:19:24 2014 UTC
@@ -494,7 +494,7 @@
// This convoluted DCHECK is needed to work around a gcc problem that
// improperly detects an array bounds overflow in optimized debug
builds
// when using a plain DCHECK.
- if (n >= ARRAY_SIZE(registers_)) {
+ if (n >= arraysize(registers_)) {
DCHECK(false);
return 0;
}
@@ -503,17 +503,17 @@
}
double GetDoubleRegister(unsigned n) const {
- DCHECK(n < ARRAY_SIZE(double_registers_));
+ DCHECK(n < arraysize(double_registers_));
return double_registers_[n];
}
void SetRegister(unsigned n, intptr_t value) {
- DCHECK(n < ARRAY_SIZE(registers_));
+ DCHECK(n < arraysize(registers_));
registers_[n] = value;
}
void SetDoubleRegister(unsigned n, double value) {
- DCHECK(n < ARRAY_SIZE(double_registers_));
+ DCHECK(n < arraysize(double_registers_));
double_registers_[n] = value;
}
=======================================
--- /branches/bleeding_edge/src/execution.cc Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/execution.cc Tue Aug 26 09:19:24 2014 UTC
@@ -484,7 +484,7 @@
return Call(isolate, \
isolate->name##_fun(), \
isolate->js_builtins_object(), \
- ARRAY_SIZE(argv), argv); \
+ arraysize(argv), argv); \
} while (false)
@@ -575,7 +575,7 @@
Handle<Object> result;
if (!TryCall(Handle<JSFunction>::cast(char_at),
string,
- ARRAY_SIZE(index_arg),
+ arraysize(index_arg),
index_arg).ToHandle(&result)) {
return factory->undefined_value();
}
@@ -602,7 +602,7 @@
Call(isolate,
isolate->instantiate_fun(),
isolate->js_builtins_object(),
- ARRAY_SIZE(args),
+ arraysize(args),
args),
JSFunction);
return Handle<JSFunction>::cast(result);
@@ -629,7 +629,7 @@
Call(isolate,
isolate->instantiate_fun(),
isolate->js_builtins_object(),
- ARRAY_SIZE(args),
+ arraysize(args),
args),
JSObject);
}
@@ -645,7 +645,7 @@
return Execution::Call(isolate,
isolate->configure_instance_fun(),
isolate->js_builtins_object(),
- ARRAY_SIZE(args),
+ arraysize(args),
args);
}
@@ -659,7 +659,7 @@
MaybeHandle<Object> maybe_result =
TryCall(isolate->get_stack_trace_line_fun(),
isolate->js_builtins_object(),
- ARRAY_SIZE(args),
+ arraysize(args),
args);
Handle<Object> result;
if (!maybe_result.ToHandle(&result) || !result->IsString()) {
=======================================
--- /branches/bleeding_edge/src/factory.cc Mon Aug 25 11:34:43 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc Tue Aug 26 09:19:24 2014 UTC
@@ -1139,7 +1139,7 @@
space -= Min(space, strlen(message));
p = &buffer[kBufferSize] - space;
- for (unsigned i = 0; i < ARRAY_SIZE(args); i++) {
+ for (int i = 0; i < Smi::cast(args->length())->value(); i++) {
if (space > 0) {
*p++ = ' ';
space--;
@@ -1184,7 +1184,7 @@
Handle<Object> exception;
if (!Execution::TryCall(fun,
isolate()->js_builtins_object(),
- ARRAY_SIZE(argv),
+ arraysize(argv),
argv,
&exception).ToHandle(&result)) {
return exception;
@@ -1211,7 +1211,7 @@
Handle<Object> exception;
if (!Execution::TryCall(fun,
isolate()->js_builtins_object(),
- ARRAY_SIZE(argv),
+ arraysize(argv),
argv,
&exception).ToHandle(&result)) {
return exception;
@@ -2039,7 +2039,7 @@
}
char arr[100];
- Vector<char> buffer(arr, ARRAY_SIZE(arr));
+ Vector<char> buffer(arr, arraysize(arr));
const char* str;
if (number->IsSmi()) {
int num = Handle<Smi>::cast(number)->value();
=======================================
--- /branches/bleeding_edge/src/full-codegen.cc Fri Aug 22 11:43:39 2014 UTC
+++ /branches/bleeding_edge/src/full-codegen.cc Tue Aug 26 09:19:24 2014 UTC
@@ -878,7 +878,7 @@
static_cast<int>(id) -
static_cast<int>(Runtime::kFirstInlineFunction);
DCHECK(lookup_index >= 0);
DCHECK(static_cast<size_t>(lookup_index) <
- ARRAY_SIZE(kInlineFunctionGenerators));
+ arraysize(kInlineFunctionGenerators));
return kInlineFunctionGenerators[lookup_index];
}
=======================================
--- /branches/bleeding_edge/src/global-handles.cc Mon Aug 4 11:34:54 2014
UTC
+++ /branches/bleeding_edge/src/global-handles.cc Tue Aug 26 09:19:24 2014
UTC
@@ -1007,7 +1007,7 @@
EternalHandles::EternalHandles() : size_(0) {
- for (unsigned i = 0; i < ARRAY_SIZE(singleton_handles_); i++) {
+ for (unsigned i = 0; i < arraysize(singleton_handles_); i++) {
singleton_handles_[i] = kInvalidIndex;
}
}
=======================================
--- /branches/bleeding_edge/src/heap/heap.cc Mon Aug 25 15:17:06 2014 UTC
+++ /branches/bleeding_edge/src/heap/heap.cc Tue Aug 26 09:19:24 2014 UTC
@@ -2500,7 +2500,7 @@
ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, exception);
ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, termination_exception);
- for (unsigned i = 0; i < ARRAY_SIZE(string_type_table); i++) {
+ for (unsigned i = 0; i < arraysize(string_type_table); i++) {
const StringTypeTable& entry = string_type_table[i];
{
AllocationResult allocation = AllocateMap(entry.type, entry.size);
@@ -2546,7 +2546,7 @@
ALLOCATE_MAP(FILLER_TYPE, 2 * kPointerSize, two_pointer_filler)
- for (unsigned i = 0; i < ARRAY_SIZE(struct_table); i++) {
+ for (unsigned i = 0; i < arraysize(struct_table); i++) {
const StructTable& entry = struct_table[i];
Map* map;
if (!AllocateMap(entry.type, entry.size).To(&map)) return false;
@@ -2791,7 +2791,7 @@
handle(Smi::FromInt(-5), isolate()),
Oddball::kException));
- for (unsigned i = 0; i < ARRAY_SIZE(constant_string_table); i++) {
+ for (unsigned i = 0; i < arraysize(constant_string_table); i++) {
Handle<String> str =
factory->InternalizeUtf8String(constant_string_table[i].contents);
roots_[constant_string_table[i].index] = *str;
@@ -2921,7 +2921,7 @@
kStringTableRootIndex,
};
- for (unsigned int i = 0; i < ARRAY_SIZE(writable_roots); i++) {
+ for (unsigned int i = 0; i < arraysize(writable_roots); i++) {
if (root_index == writable_roots[i]) return true;
}
return false;
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Mon Aug 25 11:34:43 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Tue Aug 26 09:19:24 2014 UTC
@@ -9767,7 +9767,7 @@
static_cast<int>(Runtime::kFirstInlineFunction);
DCHECK(lookup_index >= 0);
DCHECK(static_cast<size_t>(lookup_index) <
- ARRAY_SIZE(kInlineFunctionGenerators));
+ arraysize(kInlineFunctionGenerators));
InlineFunctionGenerator generator =
kInlineFunctionGenerators[lookup_index];
// Call the inline code generator using the pointer-to-member.
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Mon Aug 25 13:09:02
2014 UTC
+++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Tue Aug 26 09:19:24
2014 UTC
@@ -23,7 +23,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ebx };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
}
@@ -31,7 +31,7 @@
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edi };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -39,7 +39,7 @@
CodeStubInterfaceDescriptor* descriptor) {
// ToNumberStub invokes a function, and therefore needs a context.
Register registers[] = { esi, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -47,7 +47,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
}
@@ -62,7 +62,7 @@
Representation::Tagged() };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry,
representations);
}
@@ -72,7 +72,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax, ebx, ecx, edx };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
}
@@ -80,14 +80,14 @@
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ebx, edx };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void CallFunctionStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = {esi, edi};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -101,7 +101,7 @@
// TODO(turbofan): So far we don't gather type feedback and hence skip
the
// slot parameter, but ArrayConstructStub needs the vector to be
undefined.
Register registers[] = {esi, eax, edi, ebx};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -109,7 +109,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ecx, ebx, eax };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
}
@@ -118,7 +118,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax, ebx };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry);
}
@@ -139,7 +139,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { esi, edi, ebx };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -150,7 +150,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, eax,
+ descriptor->Initialize(major, arraysize(registers), registers, eax,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -169,7 +169,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { esi, edi };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -179,7 +179,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, eax,
+ descriptor->Initialize(major, arraysize(registers), registers, eax,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -226,7 +226,7 @@
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
@@ -235,7 +235,7 @@
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
@@ -245,7 +245,7 @@
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edx, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
@@ -255,7 +255,7 @@
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ecx, edx, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
@@ -263,7 +263,7 @@
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edx, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
@@ -283,7 +283,7 @@
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -295,7 +295,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -307,7 +307,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -319,7 +319,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -337,7 +337,7 @@
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
}
=======================================
--- /branches/bleeding_edge/src/isolate.cc Mon Aug 25 11:34:43 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc Tue Aug 26 09:19:24 2014 UTC
@@ -2269,7 +2269,7 @@
static const char* nested[] = {
"for", "for_api", "for_intern", "keyFor", "private_api", "private_intern"
};
- for (unsigned i = 0; i < ARRAY_SIZE(nested); ++i) {
+ for (unsigned i = 0; i < arraysize(nested); ++i) {
Handle<String> name = factory()->InternalizeUtf8String(nested[i]);
Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8);
=======================================
--- /branches/bleeding_edge/src/jsregexp.cc Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/jsregexp.cc Tue Aug 26 09:19:24 2014 UTC
@@ -53,7 +53,7 @@
Handle<String> flags) {
// Call the construct code with 2 arguments.
Handle<Object> argv[] = { pattern, flags };
- return Execution::New(constructor, ARRAY_SIZE(argv), argv);
+ return Execution::New(constructor, arraysize(argv), argv);
}
@@ -3588,18 +3588,18 @@
0x00A0, 0x00A1, 0x1680, 0x1681, 0x180E, 0x180F, 0x2000, 0x200B,
0x2028, 0x202A, 0x202F, 0x2030, 0x205F, 0x2060, 0x3000, 0x3001,
0xFEFF, 0xFF00, 0x10000 };
-static const int kSpaceRangeCount = ARRAY_SIZE(kSpaceRanges);
+static const int kSpaceRangeCount = arraysize(kSpaceRanges);
static const int kWordRanges[] = {
'0', '9' + 1, 'A', 'Z' + 1, '_', '_' + 1, 'a', 'z' + 1, 0x10000 };
-static const int kWordRangeCount = ARRAY_SIZE(kWordRanges);
+static const int kWordRangeCount = arraysize(kWordRanges);
static const int kDigitRanges[] = { '0', '9' + 1, 0x10000 };
-static const int kDigitRangeCount = ARRAY_SIZE(kDigitRanges);
+static const int kDigitRangeCount = arraysize(kDigitRanges);
static const int kSurrogateRanges[] = { 0xd800, 0xe000, 0x10000 };
-static const int kSurrogateRangeCount = ARRAY_SIZE(kSurrogateRanges);
+static const int kSurrogateRangeCount = arraysize(kSurrogateRanges);
static const int kLineTerminatorRanges[] = { 0x000A, 0x000B, 0x000D,
0x000E,
0x2028, 0x202A, 0x10000 };
-static const int kLineTerminatorRangeCount =
ARRAY_SIZE(kLineTerminatorRanges);
+static const int kLineTerminatorRangeCount =
arraysize(kLineTerminatorRanges);
void BoyerMoorePositionInfo::Set(int character) {
=======================================
--- /branches/bleeding_edge/src/lithium-codegen.cc Mon Aug 4 11:34:54 2014
UTC
+++ /branches/bleeding_edge/src/lithium-codegen.cc Tue Aug 26 09:19:24 2014
UTC
@@ -132,7 +132,7 @@
void LCodeGenBase::Comment(const char* format, ...) {
if (!FLAG_code_comments) return;
char buffer[4 * KB];
- StringBuilder builder(buffer, ARRAY_SIZE(buffer));
+ StringBuilder builder(buffer, arraysize(buffer));
va_list arguments;
va_start(arguments, format);
builder.AddFormattedList(format, arguments);
=======================================
--- /branches/bleeding_edge/src/messages.cc Tue Aug 5 08:18:22 2014 UTC
+++ /branches/bleeding_edge/src/messages.cc Tue Aug 26 09:19:24 2014 UTC
@@ -138,7 +138,7 @@
Handle<Object>(message->arguments(), isolate)
};
MaybeHandle<Object> maybe_result = Execution::TryCall(
- fun, isolate->js_builtins_object(), ARRAY_SIZE(argv), argv);
+ fun, isolate->js_builtins_object(), arraysize(argv), argv);
Handle<Object> result;
if (!maybe_result.ToHandle(&result) || !result->IsString()) {
return
factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("<error>"));
=======================================
--- /branches/bleeding_edge/src/mips/code-stubs-mips.cc Mon Aug 25 15:15:26
2014 UTC
+++ /branches/bleeding_edge/src/mips/code-stubs-mips.cc Tue Aug 26 09:19:24
2014 UTC
@@ -23,7 +23,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a2 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
}
@@ -31,14 +31,14 @@
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a1 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void ToNumberStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -46,7 +46,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
}
@@ -60,7 +60,7 @@
Representation::Smi(),
Representation::Tagged() };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry,
representations);
}
@@ -70,7 +70,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a3, a2, a1, a0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
}
@@ -78,7 +78,7 @@
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a2, a3 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -98,7 +98,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a2, a1, a0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
}
@@ -108,7 +108,7 @@
Register registers[] = { cp, a0, a1 };
Address entry =
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry;
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(entry));
}
@@ -116,7 +116,7 @@
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
@@ -139,7 +139,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { cp, a1, a2 };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -150,7 +150,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, a0,
+ descriptor->Initialize(major, arraysize(registers), registers, a0,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -170,7 +170,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { cp, a1 };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -180,7 +180,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, a0,
+ descriptor->Initialize(major, arraysize(registers), registers, a0,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -209,7 +209,7 @@
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
@@ -237,7 +237,7 @@
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a1, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
@@ -247,7 +247,7 @@
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a2, a1, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
@@ -255,7 +255,7 @@
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a1, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
@@ -275,7 +275,7 @@
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -287,7 +287,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -299,7 +299,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -311,7 +311,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -329,7 +329,7 @@
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
}
=======================================
--- /branches/bleeding_edge/src/mips64/code-stubs-mips64.cc Mon Aug 25
18:07:09 2014 UTC
+++ /branches/bleeding_edge/src/mips64/code-stubs-mips64.cc Tue Aug 26
09:19:24 2014 UTC
@@ -23,7 +23,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a2 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
}
@@ -31,14 +31,14 @@
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a1 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void ToNumberStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -46,7 +46,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
}
@@ -60,7 +60,7 @@
Representation::Smi(),
Representation::Tagged() };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry,
representations);
}
@@ -70,7 +70,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a3, a2, a1, a0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
}
@@ -90,7 +90,7 @@
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a2, a3 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -98,7 +98,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a2, a1, a0 };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
}
@@ -108,7 +108,7 @@
Register registers[] = { cp, a0, a1 };
Address entry =
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry;
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(entry));
}
@@ -116,7 +116,7 @@
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
@@ -139,7 +139,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { cp, a1, a2 };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -150,7 +150,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, a0,
+ descriptor->Initialize(major, arraysize(registers), registers, a0,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -170,7 +170,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { cp, a1 };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -180,7 +180,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, a0,
+ descriptor->Initialize(major, arraysize(registers), registers, a0,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -209,7 +209,7 @@
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
@@ -237,7 +237,7 @@
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a1, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
@@ -247,7 +247,7 @@
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a2, a1, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
@@ -255,7 +255,7 @@
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { cp, a1, a0 };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
@@ -275,7 +275,7 @@
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -287,7 +287,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -299,7 +299,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -311,7 +311,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -329,7 +329,7 @@
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
}
=======================================
--- /branches/bleeding_edge/src/mksnapshot.cc Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/mksnapshot.cc Tue Aug 26 09:19:24 2014 UTC
@@ -91,12 +91,12 @@
i::byte* snapshot_bytes = snapshot_data.begin();
sink.PutBlob(snapshot_bytes, snapshot_data.length(), "snapshot");
- for (size_t i = 0; i < ARRAY_SIZE(spaces); ++i)
+ for (size_t i = 0; i < arraysize(spaces); ++i)
sink.PutInt(serializer.CurrentAllocationAddress(spaces[i]), "spaces");
i::byte* context_bytes = context_snapshot_data.begin();
sink.PutBlob(context_bytes, context_snapshot_data.length(), "context");
- for (size_t i = 0; i < ARRAY_SIZE(spaces); ++i)
+ for (size_t i = 0; i < arraysize(spaces); ++i)
sink.PutInt(context_serializer.CurrentAllocationAddress(spaces[i]),
"spaces");
=======================================
--- /branches/bleeding_edge/src/objects.cc Mon Aug 25 15:41:09 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Tue Aug 26 09:19:24 2014 UTC
@@ -409,7 +409,7 @@
Handle<Object> args[] = { receiver, name };
return CallTrap(
- proxy, "get", isolate->derived_get_trap(), ARRAY_SIZE(args), args);
+ proxy, "get", isolate->derived_get_trap(), arraysize(args), args);
}
@@ -427,7 +427,7 @@
Handle<Object> error =
isolate->factory()->NewTypeError("incompatible_method_receiver",
HandleVector(args,
- ARRAY_SIZE(args)));
+ arraysize(args)));
return isolate->Throw<Object>(error);
}
if (structure->IsDeclaredAccessorInfo()) {
@@ -499,7 +499,7 @@
Handle<Object> error =
isolate->factory()->NewTypeError("incompatible_method_receiver",
HandleVector(args,
- ARRAY_SIZE(args)));
+ arraysize(args)));
return isolate->Throw<Object>(error);
}
Object* call_obj = info->setter();
@@ -573,7 +573,7 @@
Handle<Object> argv[] = { value };
RETURN_ON_EXCEPTION(isolate, Execution::Call(isolate, setter, receiver,
- ARRAY_SIZE(argv), argv,
true),
+ arraysize(argv), argv,
true),
Object);
return value;
}
@@ -2927,7 +2927,7 @@
Handle<Object> args[] = {it->name(), it->GetReceiver()};
Handle<Object> error = it->factory()->NewTypeError(
- "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)));
+ "strict_read_only_property", HandleVector(args, arraysize(args)));
return it->isolate()->Throw<Object>(error);
}
@@ -2992,7 +2992,7 @@
Handle<Object> args[1] = {it->name()};
Handle<Object> error = it->factory()->NewTypeError(
- "object_not_extensible", HandleVector(args, ARRAY_SIZE(args)));
+ "object_not_extensible", HandleVector(args, arraysize(args)));
return it->isolate()->Throw<Object>(error);
}
it->ApplyTransitionToDataProperty();
@@ -3401,7 +3401,7 @@
Handle<Object> result;
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, result, CallTrap(proxy, "has", isolate->derived_has_trap(),
- ARRAY_SIZE(args), args),
+ arraysize(args), args),
Maybe<bool>());
return maybe(result->BooleanValue());
@@ -3424,7 +3424,7 @@
CallTrap(proxy,
"set",
isolate->derived_set_trap(),
- ARRAY_SIZE(args),
+ arraysize(args),
args),
Object);
@@ -3452,7 +3452,7 @@
CallTrap(proxy,
"getPropertyDescriptor",
Handle<Object>(),
- ARRAY_SIZE(args),
+ arraysize(args),
args),
Object);
@@ -3469,7 +3469,7 @@
Execution::Call(isolate,
isolate->to_complete_property_descriptor(),
result,
- ARRAY_SIZE(argv),
+ arraysize(argv),
argv),
Object);
@@ -3486,7 +3486,7 @@
STATIC_ASCII_VECTOR("getPropertyDescriptor"));
Handle<Object> args[] = { handler, trap, name };
Handle<Object> error = isolate->factory()->NewTypeError(
- "proxy_prop_not_configurable", HandleVector(args,
ARRAY_SIZE(args)));
+ "proxy_prop_not_configurable", HandleVector(args,
arraysize(args)));
return isolate->Throw<Object>(error);
}
DCHECK(configurable->IsTrue());
@@ -3510,7 +3510,7 @@
if (strict_mode == SLOPPY) return value;
Handle<Object> args[] = { name, receiver };
Handle<Object> error = isolate->factory()->NewTypeError(
- "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)));
+ "strict_read_only_property", HandleVector(args, arraysize(args)));
return isolate->Throw<Object>(error);
}
@@ -3527,7 +3527,7 @@
if (strict_mode == SLOPPY) return value;
Handle<Object> args2[] = { name, proxy };
Handle<Object> error = isolate->factory()->NewTypeError(
- "no_setter_in_callback", HandleVector(args2, ARRAY_SIZE(args2)));
+ "no_setter_in_callback", HandleVector(args2, arraysize(args2)));
return isolate->Throw<Object>(error);
}
@@ -3546,7 +3546,7 @@
CallTrap(proxy,
"delete",
Handle<Object>(),
- ARRAY_SIZE(args),
+ arraysize(args),
args),
Object);
@@ -3557,7 +3557,7 @@
STATIC_ASCII_VECTOR("delete"));
Handle<Object> args[] = { handler, trap_name };
Handle<Object> error = isolate->factory()->NewTypeError(
- "handler_failed", HandleVector(args, ARRAY_SIZE(args)));
+ "handler_failed", HandleVector(args, arraysize(args)));
return isolate->Throw<Object>(error);
}
return isolate->factory()->ToBoolean(result_bool);
@@ -3585,7 +3585,7 @@
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, result,
proxy->CallTrap(proxy, "getPropertyDescriptor", Handle<Object>(),
- ARRAY_SIZE(args), args),
+ arraysize(args), args),
Maybe<PropertyAttributes>());
if (result->IsUndefined()) return maybe(ABSENT);
@@ -3595,7 +3595,7 @@
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, desc,
Execution::Call(isolate, isolate->to_complete_property_descriptor(),
- result, ARRAY_SIZE(argv), argv),
+ result, arraysize(argv), argv),
Maybe<PropertyAttributes>());
// Convert result to PropertyAttributes.
@@ -3633,7 +3633,7 @@
STATIC_ASCII_VECTOR("getPropertyDescriptor"));
Handle<Object> args[] = { handler, trap, name };
Handle<Object> error = isolate->factory()->NewTypeError(
- "proxy_prop_not_configurable", HandleVector(args,
ARRAY_SIZE(args)));
+ "proxy_prop_not_configurable", HandleVector(args,
arraysize(args)));
isolate->Throw(*error);
return maybe(NONE);
}
@@ -3695,7 +3695,7 @@
if (derived.is_null()) {
Handle<Object> args[] = { handler, trap_name };
Handle<Object> error = isolate->factory()->NewTypeError(
- "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args)));
+ "handler_trap_missing", HandleVector(args, arraysize(args)));
return isolate->Throw<Object>(error);
}
trap = Handle<Object>(derived);
@@ -4958,7 +4958,7 @@
if (delete_mode == STRICT_DELETION) {
Handle<Object> args[2] = {name, object};
Handle<Object> error = it.isolate()->factory()->NewTypeError(
- "strict_delete_property", HandleVector(args,
ARRAY_SIZE(args)));
+ "strict_delete_property", HandleVector(args,
arraysize(args)));
it.isolate()->Throw(*error);
return Handle<Object>();
}
@@ -5823,7 +5823,7 @@
Execution::Call(isolate,
isolate->proxy_enumerate(),
object,
- ARRAY_SIZE(args),
+ arraysize(args),
args),
FixedArray);
ASSIGN_RETURN_ON_EXCEPTION(
@@ -11168,7 +11168,7 @@
Execution::Call(isolate,
Handle<JSFunction>(isolate->observers_enqueue_splice()),
isolate->factory()->undefined_value(),
- ARRAY_SIZE(args),
+ arraysize(args),
args).Assert();
}
@@ -11181,7 +11181,7 @@
Execution::Call(isolate,
Handle<JSFunction>(isolate->observers_begin_perform_splice()),
isolate->factory()->undefined_value(),
- ARRAY_SIZE(args),
+ arraysize(args),
args).Assert();
}
@@ -11194,7 +11194,7 @@
Execution::Call(isolate,
Handle<JSFunction>(isolate->observers_end_perform_splice()),
isolate->factory()->undefined_value(),
- ARRAY_SIZE(args),
+ arraysize(args),
args).Assert();
}
@@ -11714,7 +11714,7 @@
if (!object->map()->is_extensible()) {
Handle<Object> args[] = { object };
Handle<Object> error = isolate->factory()->NewTypeError(
- "non_extensible_proto", HandleVector(args, ARRAY_SIZE(args)));
+ "non_extensible_proto", HandleVector(args, arraysize(args)));
return isolate->Throw<Object>(error);
}
@@ -12413,7 +12413,7 @@
Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
Handle<Object> args[] = { object, number };
Handle<Object> error = isolate->factory()->NewTypeError(
- "redef_external_array_element", HandleVector(args,
ARRAY_SIZE(args)));
+ "redef_external_array_element", HandleVector(args,
arraysize(args)));
return isolate->Throw<Object>(error);
}
@@ -12867,7 +12867,7 @@
Handle<Name> length = isolate->factory()->length_string();
Handle<Object> args[2] = { length, array };
Handle<Object> error = isolate->factory()->NewTypeError(
- "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)));
+ "strict_read_only_property", HandleVector(args, arraysize(args)));
return isolate->Throw<Object>(error);
}
=======================================
--- /branches/bleeding_edge/src/parser.cc Fri Aug 22 14:40:38 2014 UTC
+++ /branches/bleeding_edge/src/parser.cc Tue Aug 26 09:19:24 2014 UTC
@@ -632,7 +632,7 @@
double double_value = parser_->scanner()->DoubleValue();
char array[100];
const char* string =
- DoubleToCString(double_value, Vector<char>(array,
ARRAY_SIZE(array)));
+ DoubleToCString(double_value, Vector<char>(array, arraysize(array)));
return ast_value_factory()->GetOneByteString(string);
}
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon Aug 25 11:34:43 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc Tue Aug 26 09:19:24 2014 UTC
@@ -290,7 +290,7 @@
DCHECK(key->IsNumber());
double num = key->Number();
char arr[100];
- Vector<char> buffer(arr, ARRAY_SIZE(arr));
+ Vector<char> buffer(arr, arraysize(arr));
const char* str = DoubleToCString(num, buffer);
Handle<String> name =
isolate->factory()->NewStringFromAsciiChecked(str);
maybe_result = JSObject::SetOwnPropertyIgnoreAttributes(boilerplate,
name,
@@ -14333,7 +14333,7 @@
CONVERT_ARG_HANDLE_CHECKED(String, stringValue, 0);
CONVERT_NUMBER_CHECKED(int, form_id, Int32, args[1]);
RUNTIME_ASSERT(form_id >= 0 &&
- static_cast<size_t>(form_id) <
ARRAY_SIZE(normalizationForms));
+ static_cast<size_t>(form_id) <
arraysize(normalizationForms));
v8::String::Value string_value(v8::Utils::ToLocal(stringValue));
const UChar* u_value = reinterpret_cast<const UChar*>(*string_value);
@@ -14719,7 +14719,7 @@
Handle<Object> argv[] = { key_handle };
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, value,
- Execution::Call(isolate, factory, receiver, ARRAY_SIZE(argv),
argv));
+ Execution::Call(isolate, factory, receiver, arraysize(argv),
argv));
}
#ifdef VERIFY_HEAP
@@ -15643,7 +15643,7 @@
const Runtime::Function* Runtime::FunctionForEntry(Address entry) {
- for (size_t i = 0; i < ARRAY_SIZE(kIntrinsicFunctions); ++i) {
+ for (size_t i = 0; i < arraysize(kIntrinsicFunctions); ++i) {
if (entry == kIntrinsicFunctions[i].entry) {
return &(kIntrinsicFunctions[i]);
}
=======================================
--- /branches/bleeding_edge/src/serialize.cc Fri Aug 22 11:43:39 2014 UTC
+++ /branches/bleeding_edge/src/serialize.cc Tue Aug 26 09:19:24 2014 UTC
@@ -314,7 +314,7 @@
#undef IC_ENTRY
}; // end of ref_table[].
- for (size_t i = 0; i < ARRAY_SIZE(ref_table); ++i) {
+ for (size_t i = 0; i < arraysize(ref_table); ++i) {
AddFromId(ref_table[i].type,
ref_table[i].id,
ref_table[i].name,
@@ -340,7 +340,7 @@
}; // end of stats_ref_table[].
Counters* counters = isolate->counters();
- for (size_t i = 0; i < ARRAY_SIZE(stats_ref_table); ++i) {
+ for (size_t i = 0; i < arraysize(stats_ref_table); ++i) {
Add(reinterpret_cast<Address>(GetInternalPointer(
(counters->*(stats_ref_table[i].counter))())),
STATS_COUNTER,
=======================================
--- /branches/bleeding_edge/src/strtod.cc Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/strtod.cc Tue Aug 26 09:19:24 2014 UTC
@@ -63,7 +63,7 @@
// 10^22 = 0x21e19e0c9bab2400000 = 0x878678326eac9 * 2^22
10000000000000000000000.0
};
-static const int kExactPowersOfTenSize = ARRAY_SIZE(exact_powers_of_ten);
+static const int kExactPowersOfTenSize = arraysize(exact_powers_of_ten);
// Maximum number of significant digits in the decimal representation.
// In fact the value is 772 (see conversions.cc), but to give us some
margin
=======================================
--- /branches/bleeding_edge/src/types.cc Thu Aug 7 15:30:16 2014 UTC
+++ /branches/bleeding_edge/src/types.cc Tue Aug 26 09:19:24 2014 UTC
@@ -882,7 +882,7 @@
bool is_first = true;
os << "(";
- for (int i(ARRAY_SIZE(named_bitsets) - 1); bitset != 0 && i >= 0; --i) {
+ for (int i(arraysize(named_bitsets) - 1); bitset != 0 && i >= 0; --i) {
int subset = named_bitsets[i];
if ((bitset & subset) == subset) {
if (!is_first) os << " | ";
=======================================
--- /branches/bleeding_edge/src/vector.h Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/vector.h Tue Aug 26 09:19:24 2014 UTC
@@ -153,7 +153,7 @@
#define STATIC_ASCII_VECTOR(x) \
v8::internal::Vector<const uint8_t>(reinterpret_cast<const uint8_t*>(x),
\
- ARRAY_SIZE(x)-1)
+ arraysize(x)-1)
inline Vector<const char> CStrVector(const char* data) {
return Vector<const char>(data, StrLength(data));
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Mon Aug 25 13:09:02
2014 UTC
+++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Tue Aug 26 09:19:24
2014 UTC
@@ -23,7 +23,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rbx };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
}
@@ -31,14 +31,14 @@
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rdi };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void ToNumberStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -46,7 +46,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rax };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
}
@@ -61,7 +61,7 @@
Representation::Tagged() };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry,
representations);
}
@@ -71,7 +71,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rax, rbx, rcx, rdx };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
}
@@ -79,14 +79,14 @@
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rbx, rdx };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void CallFunctionStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = {rsi, rdi};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -100,7 +100,7 @@
// TODO(turbofan): So far we don't gather type feedback and hence skip
the
// slot parameter, but ArrayConstructStub needs the vector to be
undefined.
Register registers[] = {rsi, rax, rdi, rbx};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -108,7 +108,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rcx, rbx, rax };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
}
@@ -117,7 +117,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rax, rbx };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry);
}
@@ -137,7 +137,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { rsi, rdi, rbx };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -148,7 +148,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, rax,
+ descriptor->Initialize(major, arraysize(registers), registers, rax,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -168,7 +168,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { rsi, rdi };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -178,7 +178,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, rax,
+ descriptor->Initialize(major, arraysize(registers), registers, rax,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -225,7 +225,7 @@
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
@@ -235,7 +235,7 @@
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
@@ -245,7 +245,7 @@
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rdx, rax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
@@ -255,7 +255,7 @@
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rcx, rdx, rax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
@@ -263,7 +263,7 @@
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { rsi, rdx, rax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
@@ -283,7 +283,7 @@
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -295,7 +295,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -307,7 +307,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -319,7 +319,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -337,7 +337,7 @@
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
}
=======================================
--- /branches/bleeding_edge/src/x87/code-stubs-x87.cc Tue Aug 26 03:56:24
2014 UTC
+++ /branches/bleeding_edge/src/x87/code-stubs-x87.cc Tue Aug 26 09:19:24
2014 UTC
@@ -23,7 +23,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ebx };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry);
}
@@ -31,7 +31,7 @@
void FastNewContextStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edi };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -39,7 +39,7 @@
CodeStubInterfaceDescriptor* descriptor) {
// ToNumberStub invokes a function, and therefore needs a context.
Register registers[] = { esi, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -47,7 +47,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry);
}
@@ -62,7 +62,7 @@
Representation::Tagged() };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry,
representations);
}
@@ -72,7 +72,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax, ebx, ecx, edx };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry);
}
@@ -80,14 +80,14 @@
void CreateAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ebx, edx };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
void CallFunctionStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = {esi, edi};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -101,7 +101,7 @@
// TODO(turbofan): So far we don't gather type feedback and hence skip
the
// slot parameter, but ArrayConstructStub needs the vector to be
undefined.
Register registers[] = {esi, eax, edi, ebx};
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers);
}
@@ -109,7 +109,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ecx, ebx, eax };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry);
}
@@ -118,7 +118,7 @@
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax, ebx };
descriptor->Initialize(
- MajorKey(), ARRAY_SIZE(registers), registers,
+ MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry);
}
@@ -139,7 +139,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { esi, edi, ebx };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -150,7 +150,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, eax,
+ descriptor->Initialize(major, arraysize(registers), registers, eax,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -169,7 +169,7 @@
if (constant_stack_parameter_count == 0) {
Register registers[] = { esi, edi };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(major, arraysize(registers), registers,
deopt_handler, NULL,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE);
} else {
@@ -179,7 +179,7 @@
Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32() };
- descriptor->Initialize(major, ARRAY_SIZE(registers), registers, eax,
+ descriptor->Initialize(major, arraysize(registers), registers, eax,
deopt_handler, representations,
constant_stack_parameter_count,
JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS);
@@ -226,7 +226,7 @@
void CompareNilICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(CompareNilIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate()));
@@ -235,7 +235,7 @@
void ToBooleanStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(ToBooleanIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate()));
@@ -245,7 +245,7 @@
void BinaryOpICStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edx, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_Miss));
descriptor->SetMissHandler(
ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate()));
@@ -255,7 +255,7 @@
void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, ecx, edx, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite));
}
@@ -263,7 +263,7 @@
void StringAddStub::InitializeInterfaceDescriptor(
CodeStubInterfaceDescriptor* descriptor) {
Register registers[] = { esi, edx, eax };
- descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers,
+ descriptor->Initialize(MajorKey(), arraysize(registers), registers,
Runtime::FunctionForId(Runtime::kStringAdd)->entry);
}
@@ -283,7 +283,7 @@
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -295,7 +295,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // key
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -307,7 +307,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // name
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -319,7 +319,7 @@
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
{
CallInterfaceDescriptor* descriptor =
@@ -337,7 +337,7 @@
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
- descriptor->Initialize(ARRAY_SIZE(registers), registers,
representations);
+ descriptor->Initialize(arraysize(registers), registers,
representations);
}
}
=======================================
---
/branches/bleeding_edge/test/base-unittests/platform/platform-unittest.cc
Tue Aug 12 13:33:35 2014 UTC
+++
/branches/bleeding_edge/test/base-unittests/platform/platform-unittest.cc
Tue Aug 26 09:19:24 2014 UTC
@@ -56,40 +56,40 @@
class ThreadLocalStorageTest : public Thread, public ::testing::Test {
public:
ThreadLocalStorageTest() : Thread(Options("ThreadLocalStorageTest")) {
- for (size_t i = 0; i < ARRAY_SIZE(keys_); ++i) {
+ for (size_t i = 0; i < arraysize(keys_); ++i) {
keys_[i] = Thread::CreateThreadLocalKey();
}
}
~ThreadLocalStorageTest() {
- for (size_t i = 0; i < ARRAY_SIZE(keys_); ++i) {
+ for (size_t i = 0; i < arraysize(keys_); ++i) {
Thread::DeleteThreadLocalKey(keys_[i]);
}
}
virtual void Run() V8_FINAL V8_OVERRIDE {
- for (size_t i = 0; i < ARRAY_SIZE(keys_); i++) {
+ for (size_t i = 0; i < arraysize(keys_); i++) {
CHECK(!Thread::HasThreadLocal(keys_[i]));
}
- for (size_t i = 0; i < ARRAY_SIZE(keys_); i++) {
+ for (size_t i = 0; i < arraysize(keys_); i++) {
Thread::SetThreadLocal(keys_[i], GetValue(i));
}
- for (size_t i = 0; i < ARRAY_SIZE(keys_); i++) {
+ for (size_t i = 0; i < arraysize(keys_); i++) {
CHECK(Thread::HasThreadLocal(keys_[i]));
}
- for (size_t i = 0; i < ARRAY_SIZE(keys_); i++) {
+ for (size_t i = 0; i < arraysize(keys_); i++) {
CHECK_EQ(GetValue(i), Thread::GetThreadLocal(keys_[i]));
CHECK_EQ(GetValue(i), Thread::GetExistingThreadLocal(keys_[i]));
}
- for (size_t i = 0; i < ARRAY_SIZE(keys_); i++) {
- Thread::SetThreadLocal(keys_[i], GetValue(ARRAY_SIZE(keys_) - i -
1));
+ for (size_t i = 0; i < arraysize(keys_); i++) {
+ Thread::SetThreadLocal(keys_[i], GetValue(arraysize(keys_) - i - 1));
}
- for (size_t i = 0; i < ARRAY_SIZE(keys_); i++) {
+ for (size_t i = 0; i < arraysize(keys_); i++) {
CHECK(Thread::HasThreadLocal(keys_[i]));
}
- for (size_t i = 0; i < ARRAY_SIZE(keys_); i++) {
- CHECK_EQ(GetValue(ARRAY_SIZE(keys_) - i - 1),
+ for (size_t i = 0; i < arraysize(keys_); i++) {
+ CHECK_EQ(GetValue(arraysize(keys_) - i - 1),
Thread::GetThreadLocal(keys_[i]));
- CHECK_EQ(GetValue(ARRAY_SIZE(keys_) - i - 1),
+ CHECK_EQ(GetValue(arraysize(keys_) - i - 1),
Thread::GetExistingThreadLocal(keys_[i]));
}
}
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/call-tester.h Mon Aug 25
10:35:38 2014 UTC
+++ /branches/bleeding_edge/test/cctest/compiler/call-tester.h Tue Aug 26
09:19:24 2014 UTC
@@ -280,14 +280,14 @@
template <typename P1>
void VerifyParameters1() {
MachineType parameters[] = {ReturnValueTraits<P1>::Representation()};
- VerifyParameters(ARRAY_SIZE(parameters), parameters);
+ VerifyParameters(arraysize(parameters), parameters);
}
template <typename P1, typename P2>
void VerifyParameters2() {
MachineType parameters[] = {ReturnValueTraits<P1>::Representation(),
ReturnValueTraits<P2>::Representation()};
- VerifyParameters(ARRAY_SIZE(parameters), parameters);
+ VerifyParameters(arraysize(parameters), parameters);
}
template <typename P1, typename P2, typename P3>
@@ -295,7 +295,7 @@
MachineType parameters[] = {ReturnValueTraits<P1>::Representation(),
ReturnValueTraits<P2>::Representation(),
ReturnValueTraits<P3>::Representation()};
- VerifyParameters(ARRAY_SIZE(parameters), parameters);
+ VerifyParameters(arraysize(parameters), parameters);
}
template <typename P1, typename P2, typename P3, typename P4>
@@ -304,7 +304,7 @@
ReturnValueTraits<P2>::Representation(),
ReturnValueTraits<P3>::Representation(),
ReturnValueTraits<P4>::Representation()};
- VerifyParameters(ARRAY_SIZE(parameters), parameters);
+ VerifyParameters(arraysize(parameters), parameters);
}
#endif
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-branch-combine.cc Thu
Aug 14 09:19:54 2014 UTC
+++ /branches/bleeding_edge/test/cctest/compiler/test-branch-combine.cc Tue
Aug 26 09:19:24 2014 UTC
@@ -360,7 +360,7 @@
TEST(BranchCombineInt32CmpAllInputShapes_materialized) {
- for (size_t i = 0; i < ARRAY_SIZE(int32cmp_opcodes); i++) {
+ for (size_t i = 0; i < arraysize(int32cmp_opcodes); i++) {
CmpMaterializeBoolGen gen(int32cmp_opcodes[i], false);
Int32BinopInputShapeTester tester(&gen);
tester.TestAllInputShapes();
@@ -369,7 +369,7 @@
TEST(BranchCombineInt32CmpAllInputShapes_inverted_materialized) {
- for (size_t i = 0; i < ARRAY_SIZE(int32cmp_opcodes); i++) {
+ for (size_t i = 0; i < arraysize(int32cmp_opcodes); i++) {
CmpMaterializeBoolGen gen(int32cmp_opcodes[i], true);
Int32BinopInputShapeTester tester(&gen);
tester.TestAllInputShapes();
@@ -378,7 +378,7 @@
TEST(BranchCombineInt32CmpAllInputShapes_branch_true) {
- for (int i = 0; i < static_cast<int>(ARRAY_SIZE(int32cmp_opcodes)); i++)
{
+ for (int i = 0; i < static_cast<int>(arraysize(int32cmp_opcodes)); i++) {
CmpBranchGen gen(int32cmp_opcodes[i], false, false, 995 + i, -1011 -
i);
Int32BinopInputShapeTester tester(&gen);
tester.TestAllInputShapes();
@@ -387,7 +387,7 @@
TEST(BranchCombineInt32CmpAllInputShapes_branch_false) {
- for (int i = 0; i < static_cast<int>(ARRAY_SIZE(int32cmp_opcodes)); i++)
{
+ for (int i = 0; i < static_cast<int>(arraysize(int32cmp_opcodes)); i++) {
CmpBranchGen gen(int32cmp_opcodes[i], false, true, 795 + i, -2011 - i);
Int32BinopInputShapeTester tester(&gen);
tester.TestAllInputShapes();
@@ -396,7 +396,7 @@
TEST(BranchCombineInt32CmpAllInputShapes_inverse_branch_true) {
- for (int i = 0; i < static_cast<int>(ARRAY_SIZE(int32cmp_opcodes)); i++)
{
+ for (int i = 0; i < static_cast<int>(arraysize(int32cmp_opcodes)); i++) {
CmpBranchGen gen(int32cmp_opcodes[i], true, false, 695 + i, -3011 - i);
Int32BinopInputShapeTester tester(&gen);
tester.TestAllInputShapes();
@@ -405,7 +405,7 @@
TEST(BranchCombineInt32CmpAllInputShapes_inverse_branch_false) {
- for (int i = 0; i < static_cast<int>(ARRAY_SIZE(int32cmp_opcodes)); i++)
{
+ for (int i = 0; i < static_cast<int>(arraysize(int32cmp_opcodes)); i++) {
CmpBranchGen gen(int32cmp_opcodes[i], true, true, 595 + i, -4011 - i);
Int32BinopInputShapeTester tester(&gen);
tester.TestAllInputShapes();
@@ -428,7 +428,7 @@
CompareWrapper(IrOpcode::kFloat64LessThan),
CompareWrapper(IrOpcode::kFloat64LessThanOrEqual)};
- for (size_t c = 0; c < ARRAY_SIZE(cmps); c++) {
+ for (size_t c = 0; c < arraysize(cmps); c++) {
CompareWrapper cmp = cmps[c];
for (int invert = 0; invert < 2; invert++) {
RawMachineAssemblerTester<int32_t> m;
@@ -444,8 +444,8 @@
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- for (size_t i = 0; i < ARRAY_SIZE(inputs); i++) {
- for (size_t j = 0; j < ARRAY_SIZE(inputs); j += 2) {
+ for (size_t i = 0; i < arraysize(inputs); i++) {
+ for (size_t j = 0; j < arraysize(inputs); j += 2) {
input_a = inputs[i];
input_b = inputs[i];
int32_t expected =
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-instruction.cc Mon
Aug 18 13:28:10 2014 UTC
+++ /branches/bleeding_edge/test/cctest/compiler/test-instruction.cc Tue
Aug 26 09:19:24 2014 UTC
@@ -324,9 +324,9 @@
new (&zone)
UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER),
new (&zone)
UnallocatedOperand(UnallocatedOperand::MUST_HAVE_REGISTER)};
- for (size_t i = 0; i < ARRAY_SIZE(outputs); i++) {
- for (size_t j = 0; j < ARRAY_SIZE(inputs); j++) {
- for (size_t k = 0; k < ARRAY_SIZE(temps); k++) {
+ for (size_t i = 0; i < arraysize(outputs); i++) {
+ for (size_t j = 0; j < arraysize(inputs); j++) {
+ for (size_t k = 0; k < arraysize(temps); k++) {
TestInstr* m =
TestInstr::New(&zone, 101, i, outputs, j, inputs, k, temps);
CHECK(i == m->OutputCount());
=======================================
***Additional files exist in this changeset.***
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.