Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 61c6593

Browse filesBrowse files
Benjamin Poulainwebkit-commit-queue
authored andcommitted
[JSC] Make B3 Return opcode work without arguments
https://bugs.webkit.org/show_bug.cgi?id=160787 Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-08-11 Reviewed by Keith Miller. We need a way to create functions that do not return values. * assembler/MacroAssembler.h: (JSC::MacroAssembler::retVoid): * b3/B3BasicBlock.cpp: (JSC::B3::BasicBlock::appendNewControlValue): * b3/B3LowerToAir.cpp: (JSC::B3::Air::LowerToAir::lower): * b3/B3Validate.cpp: * b3/B3Value.h: * b3/air/AirOpcode.opcodes: * b3/testb3.cpp: (JSC::B3::testReturnVoid): (JSC::B3::run): Canonical link: https://commits.webkit.org/178912@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 1c401f7 commit 61c6593
Copy full SHA for 61c6593

8 files changed

+44-3Lines changed: 44 additions & 3 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Source/JavaScriptCore/ChangeLog‎

Copy file name to clipboardExpand all lines: Source/JavaScriptCore/ChangeLog
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
2016-08-11 Benjamin Poulain <bpoulain@apple.com>
2+
3+
[JSC] Make B3 Return opcode work without arguments
4+
https://bugs.webkit.org/show_bug.cgi?id=160787
5+
6+
Reviewed by Keith Miller.
7+
8+
We need a way to create functions that do not return values.
9+
10+
* assembler/MacroAssembler.h:
11+
(JSC::MacroAssembler::retVoid):
12+
* b3/B3BasicBlock.cpp:
13+
(JSC::B3::BasicBlock::appendNewControlValue):
14+
* b3/B3LowerToAir.cpp:
15+
(JSC::B3::Air::LowerToAir::lower):
16+
* b3/B3Validate.cpp:
17+
* b3/B3Value.h:
18+
* b3/air/AirOpcode.opcodes:
19+
* b3/testb3.cpp:
20+
(JSC::B3::testReturnVoid):
21+
(JSC::B3::run):
22+
123
2016-08-11 Mark Lam <mark.lam@apple.com>
224

325
Gardening: fix gcc builds after r204387.
Collapse file

‎Source/JavaScriptCore/assembler/MacroAssembler.h‎

Copy file name to clipboardExpand all lines: Source/JavaScriptCore/assembler/MacroAssembler.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ class MacroAssembler : public MacroAssemblerBase {
492492

493493
// B3 has additional pseudo-opcodes for returning, when it wants to signal that the return
494494
// consumes some register in some way.
495+
void retVoid() { ret(); }
495496
void ret32(RegisterID) { ret(); }
496497
void ret64(RegisterID) { ret(); }
497498
void retFloat(FPRegisterID) { ret(); }
Collapse file

‎Source/JavaScriptCore/b3/B3BasicBlock.cpp‎

Copy file name to clipboardExpand all lines: Source/JavaScriptCore/b3/B3BasicBlock.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ void BasicBlock::deepDump(const Procedure& proc, PrintStream& out) const
166166

167167
Value* BasicBlock::appendNewControlValue(Procedure& proc, Opcode opcode, Origin origin)
168168
{
169-
RELEASE_ASSERT(opcode == Oops);
169+
RELEASE_ASSERT(opcode == Oops || opcode == Return);
170170
clearSuccessors();
171171
return appendNew<Value>(proc, opcode, origin);
172172
}
Collapse file

‎Source/JavaScriptCore/b3/B3LowerToAir.cpp‎

Copy file name to clipboardExpand all lines: Source/JavaScriptCore/b3/B3LowerToAir.cpp
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,6 +2431,10 @@ class LowerToAir {
24312431
}
24322432

24332433
case Return: {
2434+
if (!m_value->numChildren()) {
2435+
append(RetVoid);
2436+
return;
2437+
}
24342438
Value* value = m_value->child(0);
24352439
Tmp returnValueGPR = Tmp(GPRInfo::returnValueGPR);
24362440
Tmp returnValueFPR = Tmp(FPRInfo::returnValueFPR);
Collapse file

‎Source/JavaScriptCore/b3/B3Validate.cpp‎

Copy file name to clipboardExpand all lines: Source/JavaScriptCore/b3/B3Validate.cpp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class Validater {
388388
VALIDATE(!valueOwner.get(value)->numSuccessors(), ("At ", *value));
389389
break;
390390
case Return:
391-
VALIDATE(value->numChildren() == 1, ("At ", *value));
391+
VALIDATE(value->numChildren() <= 1, ("At ", *value));
392392
VALIDATE(value->type() == Void, ("At ", *value));
393393
VALIDATE(!valueOwner.get(value)->numSuccessors(), ("At ", *value));
394394
break;
Collapse file

‎Source/JavaScriptCore/b3/B3Value.h‎

Copy file name to clipboardExpand all lines: Source/JavaScriptCore/b3/B3Value.h
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ class JS_EXPORT_PRIVATE Value {
287287
if (UNLIKELY(numArgs))
288288
badOpcode(opcode, numArgs);
289289
break;
290+
case Return:
291+
if (UNLIKELY(numArgs > 1))
292+
badOpcode(opcode, numArgs);
293+
break;
290294
case Identity:
291295
case Neg:
292296
case Clz:
@@ -305,7 +309,6 @@ class JS_EXPORT_PRIVATE Value {
305309
case IToF:
306310
case BitwiseCast:
307311
case Branch:
308-
case Return:
309312
if (UNLIKELY(numArgs != 1))
310313
badOpcode(opcode, numArgs);
311314
break;
Collapse file

‎Source/JavaScriptCore/b3/air/AirOpcode.opcodes‎

Copy file name to clipboardExpand all lines: Source/JavaScriptCore/b3/air/AirOpcode.opcodes
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,8 @@ MoveDoubleConditionallyFloat U:G:32, U:F:32, U:F:32, U:F:64, U:F:64, D:F:64
836836

837837
Jump /branch
838838

839+
RetVoid /return
840+
839841
Ret32 U:G:32 /return
840842
Tmp
841843

Collapse file

‎Source/JavaScriptCore/b3/testb3.cpp‎

Copy file name to clipboardExpand all lines: Source/JavaScriptCore/b3/testb3.cpp
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,14 @@ void testReturnConst64(int64_t value)
351351
CHECK(compileAndRun<int64_t>(proc) == value);
352352
}
353353

354+
void testReturnVoid()
355+
{
356+
Procedure proc;
357+
BasicBlock* root = proc.addBlock();
358+
root->appendNewControlValue(proc, Return, Origin());
359+
compileAndRun<void>(proc);
360+
}
361+
354362
void testAddArg(int a)
355363
{
356364
Procedure proc;
@@ -12944,6 +12952,7 @@ void run(const char* filter)
1294412952
RUN(testArg(43));
1294512953
RUN(testReturnConst64(5));
1294612954
RUN(testReturnConst64(-42));
12955+
RUN(testReturnVoid());
1294712956

1294812957
RUN(testAddArg(111));
1294912958
RUN(testAddArgs(1, 1));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.