Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: src/stub-cache.cc

Issue 8366036: Handlify call cases for pre-monomorphic, normal, and miss. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 isolate()->counters()->call_initialize_stubs()->Increment(); 1414 isolate()->counters()->call_initialize_stubs()->Increment();
1415 PROFILE(isolate(), 1415 PROFILE(isolate(),
1416 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_INITIALIZE_TAG), 1416 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_INITIALIZE_TAG),
1417 *code, code->arguments_count())); 1417 *code, code->arguments_count()));
1418 GDBJIT(AddCode(GDBJITInterface::CALL_INITIALIZE, *code)); 1418 GDBJIT(AddCode(GDBJITInterface::CALL_INITIALIZE, *code));
1419 return code; 1419 return code;
1420 } 1420 }
1421 1421
1422 1422
1423 Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { 1423 Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) {
1424 CALL_HEAP_FUNCTION(isolate(),
1425 (set_failure(NULL), TryCompileCallPreMonomorphic(flags)),
1426 Code);
1427 }
1428
1429
1430 MaybeObject* StubCompiler::TryCompileCallPreMonomorphic(Code::Flags flags) {
1431 HandleScope scope(isolate());
1432 int argc = Code::ExtractArgumentsCountFromFlags(flags); 1424 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1433 // The code of the PreMonomorphic stub is the same as the code 1425 // The code of the PreMonomorphic stub is the same as the code
1434 // of the Initialized stub. They just differ on the code object flags. 1426 // of the Initialized stub. They just differ on the code object flags.
1435 Code::Kind kind = Code::ExtractKindFromFlags(flags); 1427 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1436 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); 1428 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1437 if (kind == Code::CALL_IC) { 1429 if (kind == Code::CALL_IC) {
1438 CallIC::GenerateInitialize(masm(), argc, extra_state); 1430 CallIC::GenerateInitialize(masm(), argc, extra_state);
1439 } else { 1431 } else {
1440 KeyedCallIC::GenerateInitialize(masm(), argc); 1432 KeyedCallIC::GenerateInitialize(masm(), argc);
1441 } 1433 }
1442 Object* result; 1434 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallPreMonomorphic");
1443 { MaybeObject* maybe_result =
1444 TryGetCodeWithFlags(flags, "CompileCallPreMonomorphic");
1445 if (!maybe_result->ToObject(&result)) return maybe_result;
1446 }
1447 isolate()->counters()->call_premonomorphic_stubs()->Increment(); 1435 isolate()->counters()->call_premonomorphic_stubs()->Increment();
1448 Code* code = Code::cast(result);
1449 USE(code);
1450 PROFILE(isolate(), 1436 PROFILE(isolate(),
1451 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_PRE_MONOMORPHIC_TAG), 1437 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_PRE_MONOMORPHIC_TAG),
1452 code, code->arguments_count())); 1438 *code, code->arguments_count()));
1453 GDBJIT(AddCode(GDBJITInterface::CALL_PRE_MONOMORPHIC, Code::cast(code))); 1439 GDBJIT(AddCode(GDBJITInterface::CALL_PRE_MONOMORPHIC, *code));
1454 return result; 1440 return code;
1455 } 1441 }
1456 1442
1457 1443
1458 Handle<Code> StubCompiler::CompileCallNormal(Code::Flags flags) { 1444 Handle<Code> StubCompiler::CompileCallNormal(Code::Flags flags) {
1459 CALL_HEAP_FUNCTION(isolate(),
1460 (set_failure(NULL), TryCompileCallNormal(flags)),
1461 Code);
1462 }
1463
1464
1465 MaybeObject* StubCompiler::TryCompileCallNormal(Code::Flags flags) {
1466 HandleScope scope(isolate());
1467 int argc = Code::ExtractArgumentsCountFromFlags(flags); 1445 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1468 Code::Kind kind = Code::ExtractKindFromFlags(flags); 1446 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1469 if (kind == Code::CALL_IC) { 1447 if (kind == Code::CALL_IC) {
1470 // Call normal is always with a explict receiver. 1448 // Call normal is always with a explict receiver.
1471 ASSERT(!CallIC::Contextual::decode( 1449 ASSERT(!CallIC::Contextual::decode(
1472 Code::ExtractExtraICStateFromFlags(flags))); 1450 Code::ExtractExtraICStateFromFlags(flags)));
1473 CallIC::GenerateNormal(masm(), argc); 1451 CallIC::GenerateNormal(masm(), argc);
1474 } else { 1452 } else {
1475 KeyedCallIC::GenerateNormal(masm(), argc); 1453 KeyedCallIC::GenerateNormal(masm(), argc);
1476 } 1454 }
1477 Object* result; 1455 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallNormal");
1478 { MaybeObject* maybe_result = TryGetCodeWithFlags(flags, "CompileCallNormal");
1479 if (!maybe_result->ToObject(&result)) return maybe_result;
1480 }
1481 isolate()->counters()->call_normal_stubs()->Increment(); 1456 isolate()->counters()->call_normal_stubs()->Increment();
1482 Code* code = Code::cast(result);
1483 USE(code);
1484 PROFILE(isolate(), 1457 PROFILE(isolate(),
1485 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG), 1458 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG),
1486 code, code->arguments_count())); 1459 *code, code->arguments_count()));
1487 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, Code::cast(code))); 1460 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, *code));
1488 return result; 1461 return code;
1489 } 1462 }
1490 1463
1491 1464
1492 Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) { 1465 Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) {
1493 CALL_HEAP_FUNCTION(isolate(), 1466 CALL_HEAP_FUNCTION(isolate(),
1494 (set_failure(NULL), TryCompileCallMegamorphic(flags)), 1467 (set_failure(NULL), TryCompileCallMegamorphic(flags)),
1495 Code); 1468 Code);
1496 } 1469 }
1497 1470
1498 1471
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 Code* code = Code::cast(result); 1515 Code* code = Code::cast(result);
1543 USE(code); 1516 USE(code);
1544 PROFILE(isolate(), 1517 PROFILE(isolate(),
1545 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), 1518 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG),
1546 code, code->arguments_count())); 1519 code, code->arguments_count()));
1547 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code))); 1520 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, Code::cast(code)));
1548 return result; 1521 return result;
1549 } 1522 }
1550 1523
1551 1524
1552 Handle<Code> StubCompiler::CompileCallMiss(Code::Flags flags) { 1525 Handle<Code> StubCompiler::CompileCallMiss(Code::Flags flags) {
ulan 2011/10/21 11:24:42 Maybe add a comment that any change in this functi
1553 CALL_HEAP_FUNCTION(isolate(), 1526 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1554 (set_failure(NULL), TryCompileCallMiss(flags)), 1527 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1555 Code); 1528 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1529 if (kind == Code::CALL_IC) {
1530 CallIC::GenerateMiss(masm(), argc, extra_state);
1531 } else {
1532 KeyedCallIC::GenerateMiss(masm(), argc);
1533 }
1534 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMiss");
1535 isolate()->counters()->call_megamorphic_stubs()->Increment();
1536 PROFILE(isolate(),
1537 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG),
1538 *code, code->arguments_count()));
1539 GDBJIT(AddCode(GDBJITInterface::CALL_MISS, *code));
1540 return code;
1556 } 1541 }
1557 1542
1558 1543
1544 // TODO(kmillikin): This annoying raw pointer implementation should be
1545 // eliminated when the stub compiler no longer needs it.
1559 MaybeObject* StubCompiler::TryCompileCallMiss(Code::Flags flags) { 1546 MaybeObject* StubCompiler::TryCompileCallMiss(Code::Flags flags) {
1560 HandleScope scope(isolate()); 1547 HandleScope scope(isolate());
1561 int argc = Code::ExtractArgumentsCountFromFlags(flags); 1548 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1562 Code::Kind kind = Code::ExtractKindFromFlags(flags); 1549 Code::Kind kind = Code::ExtractKindFromFlags(flags);
1563 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); 1550 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1564 if (kind == Code::CALL_IC) { 1551 if (kind == Code::CALL_IC) {
1565 CallIC::GenerateMiss(masm(), argc, extra_state); 1552 CallIC::GenerateMiss(masm(), argc, extra_state);
1566 } else { 1553 } else {
1567 KeyedCallIC::GenerateMiss(masm(), argc); 1554 KeyedCallIC::GenerateMiss(masm(), argc);
1568 } 1555 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 expected_receiver_type_ = 1921 expected_receiver_type_ =
1935 FunctionTemplateInfo::cast(signature->receiver()); 1922 FunctionTemplateInfo::cast(signature->receiver());
1936 } 1923 }
1937 } 1924 }
1938 1925
1939 is_simple_api_call_ = true; 1926 is_simple_api_call_ = true;
1940 } 1927 }
1941 1928
1942 1929
1943 } } // namespace v8::internal 1930 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698