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

Unified Diff: src/frames-inl.h

Issue 1083193005: WIP: new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix return from new func Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/frames.h ('k') | src/full-codegen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames-inl.h
diff --git a/src/frames-inl.h b/src/frames-inl.h
index 650d6f9725f4ab30df736034093d6b426bbc2fb9..1a1138e24d691d95c009354fffbf9d8abe347356 100644
--- a/src/frames-inl.h
+++ b/src/frames-inl.h
@@ -158,7 +158,7 @@ inline JavaScriptFrame::JavaScriptFrame(StackFrameIteratorBase* iterator)
Address JavaScriptFrame::GetParameterSlot(int index) const {
int param_count = ComputeParametersCount();
- DCHECK(-1 <= index && index < param_count);
+ // DCHECK(-1 <= index && index < param_count);
int parameter_offset = (param_count - index - 1) * kPointerSize;
return caller_sp() + parameter_offset;
}
@@ -217,6 +217,26 @@ inline JSFunction* JavaScriptFrame::function() const {
}
+inline Object* JavaScriptFrame::NewTarget() const {
+ if (!IsConstructor()) {
+ return isolate()->heap()->undefined_value();
+ }
+
+ Address fp = this->fp();
+ if (has_adapted_arguments()) {
+ fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset);
+ }
+
+ int param_count = GetArgumentsLength();
+ // One for return address
+ // One for receiver
+ // One for original constructor
+ Object* new_target = Memory::Object_at(fp + (3 + param_count) * kPointerSize);
+ DCHECK(new_target->IsJSFunction());
+ return new_target;
+}
+
+
inline StubFrame::StubFrame(StackFrameIteratorBase* iterator)
: StandardFrame(iterator) {
}
« no previous file with comments | « src/frames.h ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698