Fix pop push optimization to work with partial snapshots (correct
registration of external references in Proxy objects). I moved the declaration of the two functions to stub-cache.h because with all the types they use it's hard to declare them anywhere else. But the actual definition is still in runtime.cc near to the place where they are used. Review URL: http://codereview.chromium.org/1079012 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4231 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
a191788398
commit
3672624b45
@ -923,7 +923,7 @@ Object* CallStubCompiler::CompileCallConstant(Object* object,
|
||||
// -- lr : return address
|
||||
// -----------------------------------
|
||||
SharedFunctionInfo* function_info = function->shared();
|
||||
if (false && function_info->HasCustomCallGenerator()) {
|
||||
if (function_info->HasCustomCallGenerator()) {
|
||||
CustomCallGenerator generator =
|
||||
ToCData<CustomCallGenerator>(function_info->function_data());
|
||||
return generator(this, object, holder, function, name, check);
|
||||
|
@ -664,6 +664,16 @@ ExternalReference ExternalReference::scheduled_exception_address() {
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::compile_array_pop_call() {
|
||||
return ExternalReference(FUNCTION_ADDR(CompileArrayPopCall));
|
||||
}
|
||||
|
||||
|
||||
ExternalReference ExternalReference::compile_array_push_call() {
|
||||
return ExternalReference(FUNCTION_ADDR(CompileArrayPushCall));
|
||||
}
|
||||
|
||||
|
||||
#ifdef V8_NATIVE_REGEXP
|
||||
|
||||
ExternalReference ExternalReference::re_check_stack_guard_state() {
|
||||
|
@ -443,6 +443,9 @@ class ExternalReference BASE_EMBEDDED {
|
||||
|
||||
static ExternalReference scheduled_exception_address();
|
||||
|
||||
static ExternalReference compile_array_pop_call();
|
||||
static ExternalReference compile_array_push_call();
|
||||
|
||||
Address address() const {return reinterpret_cast<Address>(address_);}
|
||||
|
||||
#ifdef ENABLE_DEBUGGER_SUPPORT
|
||||
|
@ -283,11 +283,11 @@ Object* Heap::PrepareForCompare(String* str) {
|
||||
const int length = str->length();
|
||||
Object* obj = str->TryFlatten();
|
||||
if (length <= kMaxAlwaysFlattenLength ||
|
||||
unflattended_strings_length_ >= kFlattenLongThreshold) {
|
||||
unflattened_strings_length_ >= kFlattenLongThreshold) {
|
||||
return obj;
|
||||
}
|
||||
if (obj->IsFailure()) {
|
||||
unflattended_strings_length_ += length;
|
||||
unflattened_strings_length_ += length;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ Heap::HeapState Heap::gc_state_ = NOT_IN_GC;
|
||||
int Heap::mc_count_ = 0;
|
||||
int Heap::gc_count_ = 0;
|
||||
|
||||
int Heap::unflattended_strings_length_ = 0;
|
||||
int Heap::unflattened_strings_length_ = 0;
|
||||
|
||||
int Heap::always_allocate_scope_depth_ = 0;
|
||||
int Heap::linear_allocation_scope_depth_ = 0;
|
||||
@ -307,7 +307,7 @@ void Heap::ReportStatisticsAfterGC() {
|
||||
void Heap::GarbageCollectionPrologue() {
|
||||
TranscendentalCache::Clear();
|
||||
gc_count_++;
|
||||
unflattended_strings_length_ = 0;
|
||||
unflattened_strings_length_ = 0;
|
||||
#ifdef DEBUG
|
||||
ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC);
|
||||
allow_allocation(false);
|
||||
|
@ -980,7 +980,7 @@ class Heap : public AllStatic {
|
||||
static int gc_count_; // how many gc happened
|
||||
|
||||
// Total length of the strings we failed to flatten since the last GC.
|
||||
static int unflattended_strings_length_;
|
||||
static int unflattened_strings_length_;
|
||||
|
||||
#define ROOT_ACCESSOR(type, name, camel_name) \
|
||||
static inline void set_##name(type* value) { \
|
||||
|
@ -1454,7 +1454,7 @@ Object* CallStubCompiler::CompileCallConstant(Object* object,
|
||||
// -----------------------------------
|
||||
|
||||
SharedFunctionInfo* function_info = function->shared();
|
||||
if (false && function_info->HasCustomCallGenerator()) {
|
||||
if (function_info->HasCustomCallGenerator()) {
|
||||
CustomCallGenerator generator =
|
||||
ToCData<CustomCallGenerator>(function_info->function_data());
|
||||
return generator(this, object, holder, function, name, check);
|
||||
|
@ -1240,9 +1240,9 @@ static Object* Runtime_FinishArrayPrototypeSetup(Arguments args) {
|
||||
|
||||
|
||||
static void SetCustomCallGenerator(Handle<JSFunction> function,
|
||||
CustomCallGenerator generator) {
|
||||
ExternalReference* generator) {
|
||||
if (function->shared()->function_data()->IsUndefined()) {
|
||||
function->shared()->set_function_data(*FromCData(generator));
|
||||
function->shared()->set_function_data(*FromCData(generator->address()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1250,7 +1250,7 @@ static void SetCustomCallGenerator(Handle<JSFunction> function,
|
||||
static Handle<JSFunction> InstallBuiltin(Handle<JSObject> holder,
|
||||
const char* name,
|
||||
Builtins::Name builtin_name,
|
||||
CustomCallGenerator generator = NULL) {
|
||||
ExternalReference* generator = NULL) {
|
||||
Handle<String> key = Factory::LookupAsciiSymbol(name);
|
||||
Handle<Code> code(Builtins::builtin(builtin_name));
|
||||
Handle<JSFunction> optimized = Factory::NewFunction(key,
|
||||
@ -1267,7 +1267,7 @@ static Handle<JSFunction> InstallBuiltin(Handle<JSObject> holder,
|
||||
}
|
||||
|
||||
|
||||
static Object* CompileArrayPushCall(CallStubCompiler* compiler,
|
||||
Object* CompileArrayPushCall(CallStubCompiler* compiler,
|
||||
Object* object,
|
||||
JSObject* holder,
|
||||
JSFunction* function,
|
||||
@ -1277,7 +1277,7 @@ static Object* CompileArrayPushCall(CallStubCompiler* compiler,
|
||||
}
|
||||
|
||||
|
||||
static Object* CompileArrayPopCall(CallStubCompiler* compiler,
|
||||
Object* CompileArrayPopCall(CallStubCompiler* compiler,
|
||||
Object* object,
|
||||
JSObject* holder,
|
||||
JSFunction* function,
|
||||
@ -1292,8 +1292,11 @@ static Object* Runtime_SpecialArrayFunctions(Arguments args) {
|
||||
ASSERT(args.length() == 1);
|
||||
CONVERT_ARG_CHECKED(JSObject, holder, 0);
|
||||
|
||||
InstallBuiltin(holder, "pop", Builtins::ArrayPop, CompileArrayPopCall);
|
||||
InstallBuiltin(holder, "push", Builtins::ArrayPush, CompileArrayPushCall);
|
||||
ExternalReference pop = ExternalReference::compile_array_pop_call();
|
||||
ExternalReference push = ExternalReference::compile_array_push_call();
|
||||
|
||||
InstallBuiltin(holder, "pop", Builtins::ArrayPop, &pop);
|
||||
InstallBuiltin(holder, "push", Builtins::ArrayPush, &push);
|
||||
InstallBuiltin(holder, "shift", Builtins::ArrayShift);
|
||||
InstallBuiltin(holder, "unshift", Builtins::ArrayUnshift);
|
||||
InstallBuiltin(holder, "slice", Builtins::ArraySlice);
|
||||
|
@ -409,36 +409,44 @@ void ExternalReferenceTable::PopulateTable() {
|
||||
UNCLASSIFIED,
|
||||
19,
|
||||
"compare_doubles");
|
||||
Add(ExternalReference::compile_array_pop_call().address(),
|
||||
UNCLASSIFIED,
|
||||
20,
|
||||
"compile_array_pop");
|
||||
Add(ExternalReference::compile_array_push_call().address(),
|
||||
UNCLASSIFIED,
|
||||
21,
|
||||
"compile_array_push");
|
||||
#ifdef V8_NATIVE_REGEXP
|
||||
Add(ExternalReference::re_case_insensitive_compare_uc16().address(),
|
||||
UNCLASSIFIED,
|
||||
20,
|
||||
22,
|
||||
"NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()");
|
||||
Add(ExternalReference::re_check_stack_guard_state().address(),
|
||||
UNCLASSIFIED,
|
||||
21,
|
||||
23,
|
||||
"RegExpMacroAssembler*::CheckStackGuardState()");
|
||||
Add(ExternalReference::re_grow_stack().address(),
|
||||
UNCLASSIFIED,
|
||||
22,
|
||||
24,
|
||||
"NativeRegExpMacroAssembler::GrowStack()");
|
||||
Add(ExternalReference::re_word_character_map().address(),
|
||||
UNCLASSIFIED,
|
||||
23,
|
||||
25,
|
||||
"NativeRegExpMacroAssembler::word_character_map");
|
||||
#endif
|
||||
// Keyed lookup cache.
|
||||
Add(ExternalReference::keyed_lookup_cache_keys().address(),
|
||||
UNCLASSIFIED,
|
||||
24,
|
||||
26,
|
||||
"KeyedLookupCache::keys()");
|
||||
Add(ExternalReference::keyed_lookup_cache_field_offsets().address(),
|
||||
UNCLASSIFIED,
|
||||
25,
|
||||
27,
|
||||
"KeyedLookupCache::field_offsets()");
|
||||
Add(ExternalReference::transcendental_cache_array_address().address(),
|
||||
UNCLASSIFIED,
|
||||
26,
|
||||
28,
|
||||
"TranscendentalCache::caches()");
|
||||
}
|
||||
|
||||
|
@ -610,6 +610,22 @@ typedef Object* (*CustomCallGenerator)(CallStubCompiler* compiler,
|
||||
StubCompiler::CheckType check);
|
||||
|
||||
|
||||
Object* CompileArrayPushCall(CallStubCompiler* compiler,
|
||||
Object* object,
|
||||
JSObject* holder,
|
||||
JSFunction* function,
|
||||
String* name,
|
||||
StubCompiler::CheckType check);
|
||||
|
||||
|
||||
Object* CompileArrayPopCall(CallStubCompiler* compiler,
|
||||
Object* object,
|
||||
JSObject* holder,
|
||||
JSFunction* function,
|
||||
String* name,
|
||||
StubCompiler::CheckType check);
|
||||
|
||||
|
||||
} } // namespace v8::internal
|
||||
|
||||
#endif // V8_STUB_CACHE_H_
|
||||
|
@ -783,7 +783,7 @@ Object* CallStubCompiler::CompileCallConstant(Object* object,
|
||||
// -----------------------------------
|
||||
|
||||
SharedFunctionInfo* function_info = function->shared();
|
||||
if (false && function_info->HasCustomCallGenerator()) {
|
||||
if (function_info->HasCustomCallGenerator()) {
|
||||
CustomCallGenerator generator =
|
||||
ToCData<CustomCallGenerator>(function_info->function_data());
|
||||
return generator(this, object, holder, function, name, check);
|
||||
|
Loading…
Reference in New Issue
Block a user