fix debug checks for api callbacks returning symbols

BUG=

Review URL: https://codereview.chromium.org/854363003

Cr-Commit-Position: refs/heads/master@{#26156}
This commit is contained in:
dcarney 2015-01-20 05:27:46 -08:00 committed by Commit bot
parent 8e56bd79f6
commit 3eb589976a
3 changed files with 30 additions and 4 deletions

View File

@ -2189,8 +2189,8 @@ void MacroAssembler::CallApiFunctionAndReturn(
JumpIfSmi(return_value, &ok, Label::kNear); JumpIfSmi(return_value, &ok, Label::kNear);
mov(map, FieldOperand(return_value, HeapObject::kMapOffset)); mov(map, FieldOperand(return_value, HeapObject::kMapOffset));
CmpInstanceType(map, FIRST_NONSTRING_TYPE); CmpInstanceType(map, LAST_NAME_TYPE);
j(below, &ok, Label::kNear); j(below_equal, &ok, Label::kNear);
CmpInstanceType(map, FIRST_SPEC_OBJECT_TYPE); CmpInstanceType(map, FIRST_SPEC_OBJECT_TYPE);
j(above_equal, &ok, Label::kNear); j(above_equal, &ok, Label::kNear);

View File

@ -805,8 +805,8 @@ void MacroAssembler::CallApiFunctionAndReturn(
JumpIfSmi(return_value, &ok, Label::kNear); JumpIfSmi(return_value, &ok, Label::kNear);
movp(map, FieldOperand(return_value, HeapObject::kMapOffset)); movp(map, FieldOperand(return_value, HeapObject::kMapOffset));
CmpInstanceType(map, FIRST_NONSTRING_TYPE); CmpInstanceType(map, LAST_NAME_TYPE);
j(below, &ok, Label::kNear); j(below_equal, &ok, Label::kNear);
CmpInstanceType(map, FIRST_SPEC_OBJECT_TYPE); CmpInstanceType(map, FIRST_SPEC_OBJECT_TYPE);
j(above_equal, &ok, Label::kNear); j(above_equal, &ok, Label::kNear);

View File

@ -23648,6 +23648,32 @@ TEST(FunctionCallOptimizationMultipleArgs) {
} }
static void ReturnsSymbolCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
info.GetReturnValue().Set(v8::Symbol::New(info.GetIsolate()));
}
TEST(ApiCallbackCanReturnSymbols) {
i::FLAG_allow_natives_syntax = true;
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
Handle<Object> global = context->Global();
Local<v8::Function> function = Function::New(isolate, ReturnsSymbolCallback);
global->Set(v8_str("x"), function);
CompileRun(
"function x_wrap() {\n"
" for (var i = 0; i < 5; i++) {\n"
" x();\n"
" }\n"
"}\n"
"x_wrap();\n"
"%OptimizeFunctionOnNextCall(x_wrap);"
"x_wrap();\n");
}
static const char* last_event_message; static const char* last_event_message;
static int last_event_status; static int last_event_status;
void StoringEventLoggerCallback(const char* message, int status) { void StoringEventLoggerCallback(const char* message, int status) {