Revision: 18790
Author: [email protected]
Date: Thu Jan 23 16:20:25 2014 UTC
Log: Remove ArrayPush from the custom call generators, and instead
call directly to the handler in crankshaft.
[email protected]
Review URL: https://codereview.chromium.org/137693003
http://code.google.com/p/v8/source/detail?r=18790
Modified:
/branches/bleeding_edge/src/arm/code-stubs-arm.cc
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
/branches/bleeding_edge/src/isolate.h
/branches/bleeding_edge/src/stub-cache.cc
/branches/bleeding_edge/src/stub-cache.h
/branches/bleeding_edge/src/x64/code-stubs-x64.cc
/branches/bleeding_edge/test/mjsunit/object-seal.js
=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Thu Jan 23 08:36:22
2014 UTC
+++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Thu Jan 23 16:20:25
2014 UTC
@@ -427,6 +427,21 @@
descriptor->param_representations_ = representations;
descriptor->platform_specific_descriptor_ = &noInlineDescriptor;
}
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(Isolate::CallHandler);
+ static Register registers[] = { cp, // context
+ r0, // receiver
+ };
+ static Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // receiver
+ };
+ descriptor->register_param_count_ = 2;
+ descriptor->register_params_ = registers;
+ descriptor->param_representations_ = representations;
+ descriptor->platform_specific_descriptor_ = &default_descriptor;
+ }
}
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Thu Jan 23 13:02:27 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Thu Jan 23 16:20:25 2014 UTC
@@ -7659,6 +7659,41 @@
Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE);
return true;
}
+ case kArrayPush: {
+ if (!expr->IsMonomorphic() || expr->check_type() !=
RECEIVER_MAP_CHECK) {
+ return false;
+ }
+ if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
+ ElementsKind elements_kind = receiver_map->elements_kind();
+ if (!IsFastElementsKind(elements_kind)) return false;
+ AddCheckConstantFunction(expr->holder(), receiver, receiver_map);
+
+ HValue* op_vals[] = {
+ context(),
+ // Receiver.
+ environment()->ExpressionStackAt(expr->arguments()->length())
+ };
+
+ const int argc = expr->arguments()->length();
+ // Includes receiver.
+ PushArgumentsFromEnvironment(argc + 1);
+
+ CallInterfaceDescriptor* descriptor =
+ isolate()->call_descriptor(Isolate::CallHandler);
+
+ ArrayPushStub stub(receiver_map->elements_kind(), argc);
+ Handle<Code> code = stub.GetCode(isolate());
+ HConstant* code_value = Add<HConstant>(code);
+
+ ASSERT((sizeof(op_vals) / kPointerSize) ==
+ descriptor->environment_length());
+
+ HInstruction* call = New<HCallWithDescriptor>(
+ code_value, argc + 1, descriptor,
+ Vector<HValue*>(op_vals, descriptor->environment_length()));
+ ast_context()->ReturnInstruction(call, expr->id());
+ return true;
+ }
default:
// Not yet supported for inlining.
break;
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Thu Jan 23 08:36:22
2014 UTC
+++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Thu Jan 23 16:20:25
2014 UTC
@@ -421,6 +421,20 @@
descriptor->register_params_ = registers;
descriptor->param_representations_ = representations;
}
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(Isolate::CallHandler);
+ static Register registers[] = { esi, // context
+ edx, // receiver
+ };
+ static Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // receiver
+ };
+ descriptor->register_param_count_ = 2;
+ descriptor->register_params_ = registers;
+ descriptor->param_representations_ = representations;
+ }
}
=======================================
--- /branches/bleeding_edge/src/isolate.h Thu Jan 16 08:17:40 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h Thu Jan 23 16:20:25 2014 UTC
@@ -1076,6 +1076,7 @@
enum CallDescriptorKey {
KeyedCall,
NamedCall,
+ CallHandler,
ArgumentAdaptorCall,
NUMBER_OF_CALL_DESCRIPTORS
};
=======================================
--- /branches/bleeding_edge/src/stub-cache.cc Thu Jan 23 08:14:00 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.cc Thu Jan 23 16:20:25 2014 UTC
@@ -1280,41 +1280,6 @@
__ InvokeFunction(actual_closure, expected, arguments(),
JUMP_FUNCTION, NullCallWrapper());
}
-
-
-Handle<Code> CallStubCompiler::CompileArrayPushCall(
- Handle<Object> object,
- Handle<JSObject> holder,
- Handle<Cell> cell,
- Handle<JSFunction> function,
- Handle<String> name,
- Code::StubType type) {
- // If object is not an array or is observed or sealed, bail out to
regular
- // call.
- if (!object->IsJSArray() ||
- !cell.is_null() ||
- Handle<JSArray>::cast(object)->map()->is_observed() ||
- !Handle<JSArray>::cast(object)->map()->is_extensible()) {
- return Handle<Code>::null();
- }
-
- Label miss;
-
- HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss);
-
- Handle<Map> map(Handle<JSArray>::cast(object)->map());
- ElementsKind elements_kind = map->elements_kind();
- const int argc = arguments().immediate();
-
- ArrayPushStub stub(elements_kind, argc);
- Handle<Code> code = stub.GetCode(isolate());
- StubCompiler::GenerateTailCall(masm(), code);
-
- HandlerFrontendFooter(&miss);
-
- // Return the generated code.
- return GetCode(type, name);
-}
Handle<Code> CallStubCompiler::CompileCallConstant(
@@ -1913,13 +1878,6 @@
bool CallStubCompiler::HasCustomCallGenerator(Handle<JSFunction> function)
{
- if (function->shared()->HasBuiltinFunctionId()) {
- BuiltinFunctionId id = function->shared()->builtin_function_id();
-#define CALL_GENERATOR_CASE(name) if (id == k##name) return true;
- CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
-#undef CALL_GENERATOR_CASE
- }
-
CallOptimization optimization(function);
return optimization.is_simple_api_call();
}
@@ -1933,21 +1891,6 @@
Handle<String> fname,
Code::StubType type) {
ASSERT(HasCustomCallGenerator(function));
-
- if (function->shared()->HasBuiltinFunctionId()) {
- BuiltinFunctionId id = function->shared()->builtin_function_id();
-#define CALL_GENERATOR_CASE(name) \
- if (id == k##name) { \
- return CallStubCompiler::Compile##name##Call(object, \
- holder, \
- cell, \
- function, \
- fname, \
- type); \
- }
- CUSTOM_CALL_IC_GENERATORS(CALL_GENERATOR_CASE)
-#undef CALL_GENERATOR_CASE
- }
CallOptimization optimization(function);
ASSERT(optimization.is_simple_api_call());
return CompileFastApiCall(optimization,
=======================================
--- /branches/bleeding_edge/src/stub-cache.h Thu Jan 23 08:14:00 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.h Thu Jan 23 16:20:25 2014 UTC
@@ -868,12 +868,6 @@
};
-// Subset of FUNCTIONS_WITH_ID_LIST with custom constant/global call
-// IC stubs.
-#define CUSTOM_CALL_IC_GENERATORS(V) \
- V(ArrayPush)
-
-
class CallStubCompiler: public StubCompiler {
public:
CallStubCompiler(Isolate* isolate,
@@ -940,16 +934,6 @@
Handle<String> name,
Code::StubType type);
-#define DECLARE_CALL_GENERATOR(name) \
- Handle<Code> Compile##name##Call(Handle<Object> object, \
- Handle<JSObject> holder, \
- Handle<Cell> cell, \
- Handle<JSFunction> function, \
- Handle<String> fname, \
- Code::StubType type);
- CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR)
-#undef DECLARE_CALL_GENERATOR
-
Handle<Code> CompileFastApiCall(const CallOptimization& optimization,
Handle<Object> object,
Handle<JSObject> holder,
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Thu Jan 23 08:36:22
2014 UTC
+++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Thu Jan 23 16:20:25
2014 UTC
@@ -418,6 +418,20 @@
descriptor->register_params_ = registers;
descriptor->param_representations_ = representations;
}
+ {
+ CallInterfaceDescriptor* descriptor =
+ isolate->call_descriptor(Isolate::CallHandler);
+ static Register registers[] = { rsi, // context
+ rdx, // receiver
+ };
+ static Representation representations[] = {
+ Representation::Tagged(), // context
+ Representation::Tagged(), // receiver
+ };
+ descriptor->register_param_count_ = 2;
+ descriptor->register_params_ = registers;
+ descriptor->param_representations_ = representations;
+ }
}
=======================================
--- /branches/bleeding_edge/test/mjsunit/object-seal.js Fri Nov 29 15:22:16
2013 UTC
+++ /branches/bleeding_edge/test/mjsunit/object-seal.js Thu Jan 23 16:20:25
2014 UTC
@@ -251,8 +251,7 @@
Object.seal(obj);
assertThrows(function() { push_call(obj); }, TypeError);
assertThrows(function() { shift_call(obj); }, TypeError);
-assertOptimized(push_call);
-// shift() doesn't have a custom call generator, so deopt will occur.
+assertUnoptimized(push_call);
assertUnoptimized(shift_call);
assertDoesNotThrow(function() { push_call(objControl); });
assertDoesNotThrow(function() { shift_call(objControl); });
--
--
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/groups/opt_out.