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

Side by Side Diff: src/hydrogen.cc

Issue 141703018: Turn RegExpConstructResultStub into a HydrogenCodeStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove dead code from LCallStub. Created 6 years, 10 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/hydrogen.h ('k') | src/hydrogen-instructions.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 1550
1551 HValue* mask = AddUncasted<HSub>(capacity, graph()->GetConstant1()); 1551 HValue* mask = AddUncasted<HSub>(capacity, graph()->GetConstant1());
1552 mask->ChangeRepresentation(Representation::Integer32()); 1552 mask->ChangeRepresentation(Representation::Integer32());
1553 mask->ClearFlag(HValue::kCanOverflow); 1553 mask->ClearFlag(HValue::kCanOverflow);
1554 1554
1555 return BuildUncheckedDictionaryElementLoadHelper(elements, key, 1555 return BuildUncheckedDictionaryElementLoadHelper(elements, key,
1556 hash, mask, 0); 1556 hash, mask, 0);
1557 } 1557 }
1558 1558
1559 1559
1560 HValue* HGraphBuilder::BuildRegExpConstructResult(HValue* length,
1561 HValue* index,
1562 HValue* input) {
1563 NoObservableSideEffectsScope scope(this);
1564
1565 // Compute the size of the RegExpResult followed by FixedArray with length.
1566 HValue* size = length;
mvstanton 2014/01/29 08:51:16 Shouldn't you verify length is a smi?
Benedikt Meurer 2014/01/29 08:55:19 Crankshaft generates an HChange (s->t) implicitly.
1567 size = AddUncasted<HShl>(size, Add<HConstant>(kPointerSizeLog2));
1568 size = AddUncasted<HAdd>(size, Add<HConstant>(static_cast<int32_t>(
1569 JSRegExpResult::kSize + FixedArray::kHeaderSize)));
1570
1571 // Make sure size does not exceeds max regular heap object size.
1572 Add<HBoundsCheck>(size, Add<HConstant>(Page::kMaxRegularHeapObjectSize));
1573
1574 // Allocate the JSRegExpResult and the FixedArray in one step.
1575 HValue* result = Add<HAllocate>(
1576 size, HType::JSArray(), NOT_TENURED, JS_ARRAY_TYPE);
mvstanton 2014/01/29 08:51:16 Actually, why not let allocation folding take care
Benedikt Meurer 2014/01/29 08:55:19 That doesn't work well with variable sized allocat
1577
1578 // Determine the elements FixedArray.
1579 HValue* elements = Add<HInnerAllocatedObject>(
1580 result, Add<HConstant>(JSRegExpResult::kSize));
1581
1582 // Initialize the JSRegExpResult header.
1583 HValue* global_object = Add<HLoadNamedField>(
1584 context(), HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
mvstanton 2014/01/29 08:51:16 Any reason to use this instead of HGlobalObject? D
Benedikt Meurer 2014/01/29 08:55:19 HGlobalObject is gone. :-)
1585 HValue* native_context = Add<HLoadNamedField>(
1586 global_object, HObjectAccess::ForGlobalObjectNativeContext());
1587 AddStoreMapNoWriteBarrier(result, Add<HLoadNamedField>(
1588 native_context, HObjectAccess::ForContextSlot(
1589 Context::REGEXP_RESULT_MAP_INDEX)));
1590 Add<HStoreNamedField>(
1591 result,
1592 HObjectAccess::ForJSArrayOffset(JSArray::kPropertiesOffset),
1593 Add<HConstant>(isolate()->factory()->empty_fixed_array()));
1594 Add<HStoreNamedField>(
1595 result,
1596 HObjectAccess::ForJSArrayOffset(JSArray::kElementsOffset),
1597 elements);
1598 Add<HStoreNamedField>(
1599 result,
1600 HObjectAccess::ForJSArrayOffset(JSArray::kLengthOffset),
1601 length);
1602
1603 // Initialize the additional fields.
1604 Add<HStoreNamedField>(
1605 result,
1606 HObjectAccess::ForJSArrayOffset(JSRegExpResult::kIndexOffset),
1607 index);
1608 Add<HStoreNamedField>(
1609 result,
1610 HObjectAccess::ForJSArrayOffset(JSRegExpResult::kInputOffset),
1611 input);
1612
1613 // Initialize the elements header.
1614 AddStoreMapConstantNoWriteBarrier(elements,
1615 isolate()->factory()->fixed_array_map());
1616 Add<HStoreNamedField>(elements, HObjectAccess::ForFixedArrayLength(), length);
1617
1618 // Initialize the elements contents with undefined.
1619 LoopBuilder loop(this, context(), LoopBuilder::kPostIncrement);
1620 index = loop.BeginBody(graph()->GetConstant0(), length, Token::LT);
1621 {
1622 Add<HStoreKeyed>(elements, index, graph()->GetConstantUndefined(),
1623 FAST_ELEMENTS);
1624 }
1625 loop.EndBody();
1626
1627 return result;
1628 }
1629
1630
1560 HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) { 1631 HValue* HGraphBuilder::BuildNumberToString(HValue* object, Type* type) {
1561 NoObservableSideEffectsScope scope(this); 1632 NoObservableSideEffectsScope scope(this);
1562 1633
1563 // Convert constant numbers at compile time. 1634 // Convert constant numbers at compile time.
1564 if (object->IsConstant() && HConstant::cast(object)->HasNumberValue()) { 1635 if (object->IsConstant() && HConstant::cast(object)->HasNumberValue()) {
1565 Handle<Object> number = HConstant::cast(object)->handle(isolate()); 1636 Handle<Object> number = HConstant::cast(object)->handle(isolate());
1566 Handle<String> result = isolate()->factory()->NumberToString(number); 1637 Handle<String> result = isolate()->factory()->NumberToString(number);
1567 return Add<HConstant>(result); 1638 return Add<HConstant>(result);
1568 } 1639 }
1569 1640
(...skipping 8770 matching lines...) Expand 10 before | Expand all | Expand 10 after
10340 CHECK_ALIVE(VisitArgumentList(call->arguments())); 10411 CHECK_ALIVE(VisitArgumentList(call->arguments()));
10341 HCallStub* result = New<HCallStub>(CodeStub::RegExpExec, 4); 10412 HCallStub* result = New<HCallStub>(CodeStub::RegExpExec, 4);
10342 Drop(4); 10413 Drop(4);
10343 return ast_context()->ReturnInstruction(result, call->id()); 10414 return ast_context()->ReturnInstruction(result, call->id());
10344 } 10415 }
10345 10416
10346 10417
10347 // Construct a RegExp exec result with two in-object properties. 10418 // Construct a RegExp exec result with two in-object properties.
10348 void HOptimizedGraphBuilder::GenerateRegExpConstructResult(CallRuntime* call) { 10419 void HOptimizedGraphBuilder::GenerateRegExpConstructResult(CallRuntime* call) {
10349 ASSERT_EQ(3, call->arguments()->length()); 10420 ASSERT_EQ(3, call->arguments()->length());
10350 CHECK_ALIVE(VisitArgumentList(call->arguments())); 10421 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
10351 HCallStub* result = New<HCallStub>(CodeStub::RegExpConstructResult, 3); 10422 CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
10352 Drop(3); 10423 CHECK_ALIVE(VisitForValue(call->arguments()->at(2)));
10353 return ast_context()->ReturnInstruction(result, call->id()); 10424 HValue* input = Pop();
10425 HValue* index = Pop();
10426 HValue* length = Pop();
10427 HValue* result = BuildRegExpConstructResult(length, index, input);
10428 return ast_context()->ReturnValue(result);
10354 } 10429 }
10355 10430
10356 10431
10357 // Support for fast native caches. 10432 // Support for fast native caches.
10358 void HOptimizedGraphBuilder::GenerateGetFromCache(CallRuntime* call) { 10433 void HOptimizedGraphBuilder::GenerateGetFromCache(CallRuntime* call) {
10359 return Bailout(kInlinedRuntimeFunctionGetFromCache); 10434 return Bailout(kInlinedRuntimeFunctionGetFromCache);
10360 } 10435 }
10361 10436
10362 10437
10363 // Fast support for number to string. 10438 // Fast support for number to string.
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
11094 if (ShouldProduceTraceOutput()) { 11169 if (ShouldProduceTraceOutput()) {
11095 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11170 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11096 } 11171 }
11097 11172
11098 #ifdef DEBUG 11173 #ifdef DEBUG
11099 graph_->Verify(false); // No full verify. 11174 graph_->Verify(false); // No full verify.
11100 #endif 11175 #endif
11101 } 11176 }
11102 11177
11103 } } // namespace v8::internal 11178 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698