OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/builtins.h" | 5 #include "src/builtins.h" |
6 | 6 |
7 #include "src/api-arguments.h" | 7 #include "src/api-arguments.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/base/ieee754.h" | 10 #include "src/base/ieee754.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 #include "src/isolate-inl.h" | 21 #include "src/isolate-inl.h" |
22 #include "src/json-parser.h" | 22 #include "src/json-parser.h" |
23 #include "src/json-stringifier.h" | 23 #include "src/json-stringifier.h" |
24 #include "src/messages.h" | 24 #include "src/messages.h" |
25 #include "src/profiler/cpu-profiler.h" | 25 #include "src/profiler/cpu-profiler.h" |
26 #include "src/property-descriptor.h" | 26 #include "src/property-descriptor.h" |
27 #include "src/prototype.h" | 27 #include "src/prototype.h" |
28 #include "src/string-builder.h" | 28 #include "src/string-builder.h" |
29 #include "src/uri.h" | 29 #include "src/uri.h" |
30 #include "src/vm-state-inl.h" | 30 #include "src/vm-state-inl.h" |
31 #include "src/wasm/wasm-js.h" | |
31 | 32 |
32 namespace v8 { | 33 namespace v8 { |
33 namespace internal { | 34 namespace internal { |
34 | 35 |
35 namespace { | 36 namespace { |
36 | 37 |
37 // Arguments object passed to C++ builtins. | 38 // Arguments object passed to C++ builtins. |
38 template <BuiltinExtraArguments extra_args> | 39 template <BuiltinExtraArguments extra_args> |
39 class BuiltinArguments : public Arguments { | 40 class BuiltinArguments : public Arguments { |
40 public: | 41 public: |
(...skipping 5303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5344 return HandleApiCallAsFunctionOrConstructor(isolate, false, args); | 5345 return HandleApiCallAsFunctionOrConstructor(isolate, false, args); |
5345 } | 5346 } |
5346 | 5347 |
5347 | 5348 |
5348 // Handle calls to non-function objects created through the API. This delegate | 5349 // Handle calls to non-function objects created through the API. This delegate |
5349 // function is used when the call is a construct call. | 5350 // function is used when the call is a construct call. |
5350 BUILTIN(HandleApiCallAsConstructor) { | 5351 BUILTIN(HandleApiCallAsConstructor) { |
5351 return HandleApiCallAsFunctionOrConstructor(isolate, true, args); | 5352 return HandleApiCallAsFunctionOrConstructor(isolate, true, args); |
5352 } | 5353 } |
5353 | 5354 |
5355 BUILTIN(CompileAsmJs) { | |
Michael Starzinger
2016/06/13 14:10:43
nit: Could we call this InstantiateAsmJs (or simil
bradnelson
2016/06/27 07:56:10
Done.
| |
5356 HandleScope handleScope(isolate); | |
5357 Handle<JSObject> foreign; | |
5358 if (args.length() > 2) { | |
5359 foreign = args.at<i::JSObject>(2); | |
5360 } | |
5361 Handle<JSArrayBuffer> memory; | |
5362 if (args.length() > 3 && args[3]->IsJSArrayBuffer()) { | |
5363 memory = args.at<i::JSArrayBuffer>(3); | |
5364 } | |
5365 Handle<JSFunction> function = args.target<i::JSFunction>(); | |
5366 Handle<Object> result; | |
5367 if (args.length() > 1 && | |
5368 WasmJs::InstantiateAsmWasm(isolate, | |
5369 handle(function->shared()->asm_wasm_data()), | |
5370 memory, foreign, &result)) { | |
5371 return *result; | |
5372 } else { | |
5373 function->shared()->ClearAsmWasmData(); | |
5374 StackLimitCheck check(isolate); | |
5375 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); | |
5376 if (!Compiler::CompileBaseline(function)) { | |
5377 return isolate->heap()->exception(); | |
5378 } | |
5379 DCHECK(function->is_compiled()); | |
5380 return function->code(); | |
Michael Starzinger
2016/06/13 14:10:43
This will return the compiled code to JavaScript.
bradnelson
2016/06/27 07:56:10
Struggled with this a bit.
I don't believe it can
| |
5381 } | |
5382 } | |
5383 | |
5354 namespace { | 5384 namespace { |
5355 | 5385 |
5356 void Generate_LoadIC_Miss(CodeStubAssembler* assembler) { | 5386 void Generate_LoadIC_Miss(CodeStubAssembler* assembler) { |
5357 typedef compiler::Node Node; | 5387 typedef compiler::Node Node; |
5358 | 5388 |
5359 Node* receiver = assembler->Parameter(0); | 5389 Node* receiver = assembler->Parameter(0); |
5360 Node* name = assembler->Parameter(1); | 5390 Node* name = assembler->Parameter(1); |
5361 Node* slot = assembler->Parameter(2); | 5391 Node* slot = assembler->Parameter(2); |
5362 Node* vector = assembler->Parameter(3); | 5392 Node* vector = assembler->Parameter(3); |
5363 Node* context = assembler->Parameter(4); | 5393 Node* context = assembler->Parameter(4); |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6005 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 6035 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
6006 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 6036 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
6007 #undef DEFINE_BUILTIN_ACCESSOR_C | 6037 #undef DEFINE_BUILTIN_ACCESSOR_C |
6008 #undef DEFINE_BUILTIN_ACCESSOR_A | 6038 #undef DEFINE_BUILTIN_ACCESSOR_A |
6009 #undef DEFINE_BUILTIN_ACCESSOR_T | 6039 #undef DEFINE_BUILTIN_ACCESSOR_T |
6010 #undef DEFINE_BUILTIN_ACCESSOR_S | 6040 #undef DEFINE_BUILTIN_ACCESSOR_S |
6011 #undef DEFINE_BUILTIN_ACCESSOR_H | 6041 #undef DEFINE_BUILTIN_ACCESSOR_H |
6012 | 6042 |
6013 } // namespace internal | 6043 } // namespace internal |
6014 } // namespace v8 | 6044 } // namespace v8 |
OLD | NEW |