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

Side by Side Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 1423723002: Map v8::Function to JSReceiver + IsCallable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 1 month 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
« no previous file with comments | « test/cctest/compiler/test-run-jscalls.cc ('k') | test/cctest/interpreter/test-interpreter.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/compiler.h" 7 #include "src/compiler.h"
8 #include "src/interpreter/bytecode-array-iterator.h" 8 #include "src/interpreter/bytecode-array-iterator.h"
9 #include "src/interpreter/bytecode-generator.h" 9 #include "src/interpreter/bytecode-generator.h"
10 #include "src/interpreter/interpreter.h" 10 #include "src/interpreter/interpreter.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*script); 44 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*script);
45 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); 45 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate());
46 } 46 }
47 47
48 48
49 Handle<BytecodeArray> MakeBytecode(const char* script, 49 Handle<BytecodeArray> MakeBytecode(const char* script,
50 const char* function_name) { 50 const char* function_name) {
51 CompileRun(script); 51 CompileRun(script);
52 Local<Function> function = 52 Local<Function> function =
53 Local<Function>::Cast(CcTest::global()->Get(v8_str(function_name))); 53 Local<Function>::Cast(CcTest::global()->Get(v8_str(function_name)));
54 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*function); 54 i::Handle<i::JSFunction> js_function =
55 i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function));
55 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); 56 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate());
56 } 57 }
57 58
58 59
59 Handle<BytecodeArray> MakeBytecodeForFunctionBody(const char* body) { 60 Handle<BytecodeArray> MakeBytecodeForFunctionBody(const char* body) {
60 ScopedVector<char> program(1024); 61 ScopedVector<char> program(1024);
61 SNPrintF(program, "function %s() { %s }\n%s();", kFunctionName, body, 62 SNPrintF(program, "function %s() { %s }\n%s();", kFunctionName, body,
62 kFunctionName); 63 kFunctionName);
63 return MakeBytecode(program.start(), kFunctionName); 64 return MakeBytecode(program.start(), kFunctionName);
64 } 65 }
(...skipping 3423 matching lines...) Expand 10 before | Expand all | Expand 10 after
3488 for (size_t i = 0; i < arraysize(snippets); i++) { 3489 for (size_t i = 0; i < arraysize(snippets); i++) {
3489 Handle<BytecodeArray> bytecode_array = 3490 Handle<BytecodeArray> bytecode_array =
3490 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); 3491 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
3491 CheckBytecodeArrayEqual(snippets[i], bytecode_array); 3492 CheckBytecodeArrayEqual(snippets[i], bytecode_array);
3492 } 3493 }
3493 } 3494 }
3494 3495
3495 } // namespace interpreter 3496 } // namespace interpreter
3496 } // namespace internal 3497 } // namespace internal
3497 } // namespace v8 3498 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-jscalls.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698