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

Side by Side Diff: src/runtime/runtime-test.cc

Issue 1132303003: Add %GetUndetectable() test intrinsic and add tests for undetectables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/deoptimizer.h" 8 #include "src/deoptimizer.h"
9 #include "src/full-codegen.h" 9 #include "src/full-codegen.h"
10 #include "src/runtime/runtime-utils.h" 10 #include "src/runtime/runtime-utils.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 206
207 RUNTIME_FUNCTION(Runtime_GetOptimizationCount) { 207 RUNTIME_FUNCTION(Runtime_GetOptimizationCount) {
208 HandleScope scope(isolate); 208 HandleScope scope(isolate);
209 DCHECK(args.length() == 1); 209 DCHECK(args.length() == 1);
210 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 210 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
211 return Smi::FromInt(function->shared()->opt_count()); 211 return Smi::FromInt(function->shared()->opt_count());
212 } 212 }
213 213
214 214
215 RUNTIME_FUNCTION(Runtime_GetUndetectable) {
216 HandleScope scope(isolate);
217 DCHECK(args.length() == 0);
218
219 Local<v8::FunctionTemplate> desc =
220 v8::FunctionTemplate::New((v8::Isolate*)isolate);
221 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
Toon Verwaest 2015/05/11 09:46:34 Seems like you just want a v8::ObjectTemplate here
titzer 2015/05/11 10:48:42 Done.
222 Local<v8::Object> obj = desc->GetFunction()->NewInstance();
223 return *Utils::OpenHandle(*obj);
224 }
225
226
215 RUNTIME_FUNCTION(Runtime_ClearFunctionTypeFeedback) { 227 RUNTIME_FUNCTION(Runtime_ClearFunctionTypeFeedback) {
216 HandleScope scope(isolate); 228 HandleScope scope(isolate);
217 DCHECK(args.length() == 1); 229 DCHECK(args.length() == 1);
218 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 230 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
219 function->shared()->ClearTypeFeedbackInfo(); 231 function->shared()->ClearTypeFeedbackInfo();
220 Code* unoptimized = function->shared()->code(); 232 Code* unoptimized = function->shared()->code();
221 if (unoptimized->kind() == Code::FUNCTION) { 233 if (unoptimized->kind() == Code::FUNCTION) {
222 unoptimized->ClearInlineCaches(); 234 unoptimized->ClearInlineCaches();
223 } 235 }
224 return isolate->heap()->undefined_value(); 236 return isolate->heap()->undefined_value();
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \ 501 RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \
490 CONVERT_ARG_CHECKED(JSObject, obj, 0); \ 502 CONVERT_ARG_CHECKED(JSObject, obj, 0); \
491 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \ 503 return isolate->heap()->ToBoolean(obj->HasFixed##Type##Elements()); \
492 } 504 }
493 505
494 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION) 506 TYPED_ARRAYS(FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION)
495 507
496 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION 508 #undef FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION
497 } 509 }
498 } // namespace v8::internal 510 } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698